![]() Step 6: Set up incoming webhooks on Discord You should see the standard set of logs that firebase produces whenever it handles an event Over on Firebase functions, you can inspect the logs for the function that was deployed to check that it correctly handled the incoming webhook. Once you've set it up, you can try create a PR or an issue, or anything that triggers the webhook, and go over to the "Recent Deliveries" tab of the webhook, where you can inspect the delivery status and payload of the webhook I have it set to notify on: "Issues", "Issue comments", "Pull requests", and "Releases". But it may be nicer to restrict it here to save on how many times your function will have to trigger. ![]() You don't have to do this as you can filter out the events in the functions in a sec. Optionally, select Let me select individual events and then select just the events you want to notify on. Set the Secret to the secret set in the previous step. Set the content type to application/json. Set the Payload URL to the address from firebase. Copy this, then go over to your github hooks in your repository (Settings > Webhooks, then Add webhook) This is the URL that you want Github to send webhooks to. Once the function is deployed, you can find its HTTP url on the Firebase web console: Inside the index.js file I added the following boilerplate for handling github webhooks using the octokit webhooks library:Įnter fullscreen mode Exit fullscreen mode Step 3: Add a github webhook receiving endpoint Had the use-case been more complicated (if we had more than one type/format of notification to send), I would have gone with it. It's also possible to install discord.js library which helps you format the outgoing webhooks to Discord API, but I've decided not to use this as the use-case is relatively simple, and I didn't want to install quite a large library unnecessarily. Github provides a convenient library for webhooks called to make processing them easily, which can be installed using npm install from inside the new functions folder that firebase creates. I selected Javascript, and some other default settings. You can either select an existing firebase project from the menu (if you created a new firebase project online or previously), or the CLI will let you create a new firebase project. ![]() ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |