From the course: Building GitHub Bots
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
GitHub webhooks and events
From the course: Building GitHub Bots
GitHub webhooks and events
- [Instructor] We learned about webhooks. Now that we learned about it, let's interact with GitHub webhooks. We are going to write some code to listen for and respond to webhook deliveries. For that, we will create a small app, using Express. I have this app ready with me. If you don't have Express installed, you can just install it using this command, npm install -g express. Hyphen G is for global installation. Once you install this, you can start writing the tiny app. Const Express is equal to the required express. That makes sure that express is imported into this application. Then we have const app is equal to express. This initializes a new express application. Then we have app.post, which defines the post route at the slash path. This path matches the path that you specified for the forwarding. In case the delivery will successfully receive, then you'll receive this response dot status 202 and send, accepted. Then you need request.headers x-github-event to learn what event type…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.