GitHub Sponsors webhook receiver and Discord forwarder, written in Node.js
This function is hosted on faasd.
Subscribe to my Insiders Updates by Sponsoring me via GitHub:
- 🐳 Sponsor now
- ⭐️ Show support and Star OpenFaaS
This function receives and validates a webhook from GitHub Sponsors using the node12 template from OpenFaaS.
Each message is verified using the crypto library and HMAC.
Messages that pass HMAC are then sent over to a secret webhook URL and appear in Discord
It is triggered by any event from GitHub Sponsors
There's a switch statement on each event, which sends send a "pretty" string such as Person X just sponsored you, or Person X cancelled their sponsorship including an appropriate emoticon for the action taken by the user.
You can pick between self-hosted OpenFaaS or OpenFaaS Cloud.
-
Fork the repo
-
Add OpenFaaS Cloud integration to your repo, the community cluster is free to use for hosting.
-
Create a channel and add an incoming webhook integration on Slack
-
Create the webhook on GitHub for your URL and enter a webhook secret
-
Seal your own secrets, change
alexellis
for your own username.
export WEBHOOK=""
export SLACK=""
faas-cli cloud seal --name alexellis-sponsors \
--literal webhook-secret=$WEBHOOK \
--literal slack-url=$SLACK
- Fire a test event from your sponsors page
You can also host a simpler version of OpenFaaS and deploy the function there:
See also: SponsorshipEvent