A simple webhook handler from github. Whenever the admins in the env file wite /bounty $xx
in any PR comment then this accepts the webhook from the github and add bounty ammount, user who created PR and more details in a notion database and makes a tweet from the authorized twitter account about which user has won the bounty.
- git clone
- cp .examples.dev.vars .dev.vars populate the necessary environment variables
- Uncomment the KV Namespace for the twitter part
bun install
bun run dev
- Use a tool like ngrok to expose your local host to internet
- Add a webhook in your repo pointing to your ngrok_url/webhook
- Add the ngrok_url/twitter-callback to the enviroment variable and the in the twitter developer app settings as the callback url for using twitter part
- Generate the clientId and clientSecret in the twitter developer app with this settings
- App Permissions as Read and Write
- Type of app as Native App (public client)
- Call backurl
cloudflare_url/twitter-callback
- Also have the notion API keys.
- add the necessary enviroment variables in the
wrangler.toml
file and uncomment them - run
bun run deploy
to deploy - Create any 4 kv_namespace in the cloudflare account
- Go to the
cloudflare worker project > settings > variables > kv namespace bindings
now make sure to add this 4 variable to different namespaces (KEEP THE SAME VARIABLE NAME) once done it will look like this and then hit deploy
access_token
refresh_token
codeVerifier
state
7. Now to setup twitter hit the URL cloudflare_url/twitter-setup
and then authorise the twitter.
8. Make sure you have added the cloudflare_url/webhook
in the github webhooks and then you are good to go.