Github 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.
Probot 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.
Now that we have an app(or a bot, used interchangeably) up and running, we’ll see how to simulate the webhook reception.
Step 1: Run the app server locally.
Step 2: 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).
Step 3: 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.
Step 4: Click on the first delivery from the top. That is your event(a new issue opened here).
Step 5: Copy the entire ‘payload’ section and paste it into a file named
issues.opened.json in test/fixtures directory.
Step 6: Now, to simulate the ‘opening of an issue’ event, open a new terminal, navigate to app’s root directory.
Step 7: Run the command:
node_modules/.bin/probot receive -e issues -p test/fixtures/issues.opened.json ./index.js
Step 8: 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.
- Using GitHub with SSH (Secure Shell)
- How to Upload a Project on Github?
- Issues in GitHub
- Making a Github Bot
- How to Upload Project on GitHub from Android Studio?
- GitHub App to Build Form using Typeform and Probot
- How to Upload Project on GitHub from Pycharm?
- GitHub App to Add or Remove Labels to Issues
- Difference Between Git and GitHub
- Sync your fork with master in GitHub
- Link your GitHub Account with R Studio
- How to Publish a Static Website on GitHub?
- Difference between MERCURIAL and GIT
- What is Git-Ignore and How to Use it?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.