Open In App
Related Articles

How to Trigger WebHooks without Events – Probot Github App

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report
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. For this tutorial, a simple github app should be up and running. To know how to do this, check out Probot docs or article(s) on Geeksforgeeks. 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. npm-run-dev-initial-success-terminal 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). new-issue-opened-gh-interface 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. recent-deliveries-page Step 4: Click on the first delivery from the top. That is your event(a new issue opened here). event-delivered-advanced-page Step 5: Copy the entire ‘payload’ section and paste it into a file named issues.opened.json in test/fixtures directory. file-saved-in-fixtures-dir 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
command-fail-on-root-dir Step 8: If the above command fails due to ‘not found file’ issues, go to ‘.bin’ folder and run the command from there. went-to-node_module-bin-to-run-command 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!


Last Updated : 17 May, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads