Skip to content

alexellis/sponsors-functions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sponsors-functions

GitHub Sponsors webhook receiver and Discord forwarder, written in Node.js

License: MIT OpenFaaS

This function is hosted on OpenFaaS Cloud, see the commits page for the build logs. The dashboard is private, but contains runtime logs and metrics.

Subscribe to my Insiders Updates by Sponsoring me via GitHub:

Usage

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.

Example

Deployment

You can pick between self-hosted OpenFaaS or OpenFaaS Cloud.

With OpenFaaS Cloud

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

With OpenFaaS or faasd

You can also host a simpler version of OpenFaaS and deploy the function there:

See also: SponsorshipEvent

Releases

No releases published

Sponsor this project

 

Packages