is a cloud-based software development website that uses Git as version control. Github is the brand ambassador of open source software development and gives developers the ability to collaborate on software development and host the source code as well. The code is hosted as the content of a repository. As the scope for Github increases, the Github apps have helped to reduce the complexity of software development, maintenance, and management.
is a framework that allows to build Github Apps. It has a rich method library that can implement any GitHub event response. A webhook delivers data to other applications as it happens, in realtime. Github webhooks allows developers to build or set up integrations, which we’ll use, which subscribe to certain events on GitHub.com. When one of those events is triggered, Github sends an HTTP POST payload to the webhook’s configured URL.
Purpose: When testing and developing the app, one might want to trigger the same event multiple times to check the response. Probot provides a way to simulate these events using a
probot receive command.
For this tutorial, a simple github app should be up and running. To know how to do this, check out Probot docs
Now that we have an app(or a bot, used interchangeably) up and running, we’ll see how to simulate the webhook reception.
Run the app server locally.
Now, trigger an event on github that you want to simulate later on. To do this, you can make an issue(if you want to simulate this event’s webhook reception).
After triggering the event, go to your app’s recent deliveries section. To navigate there, go to your app’s homepage(github.com/apps/app-name), then click on ‘Advanced’, there you will see the recent deliveries section.
Click on the first delivery from the top. That is your event(a new issue opened here).
Copy the entire ‘payload’ section and paste it into a file named
in test/fixtures directory.
Now, to simulate the ‘opening of an issue’ event, open a new terminal, navigate to app’s root directory.
Run the command:
node_modules/.bin/probot receive -e issues -p test/fixtures/issues.opened.json ./index.js
If the above command fails due to ‘not found file’ issues, go to ‘.bin’ folder and run the command from there.
By following the above steps, you will have simulated the reception of a webhook.
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!
Share your thoughts in the comments
Please Login to comment...