Bitbucket and Discord webhooks cannot understand each other by default. You need to convert Bitbucket's webhook to a format that Discord can understand. A Google Cloud function can translate and forward push commits from Bitbucket to Discord.
I use this Bot as an internal tool to give team mates a way to keep up with code changes via Discord.
- Open Discord server > Pick a channel > Edit > Webhooks > Create Webhook
- Pick a name for your Discord bot
- Copy the webhook URL and paste it into
const discordEndpoint
insideindex.js
- Follow this tutorial to set up your Google Cloud account and the gcloud shell.
- Open Google Cloud SDK Shell
- deploy to the cloud:
cd "~/REPO_PATH/bitbucket-push-to-discord" gcloud functions deploy bitbucketPushToDiscord --runtime=nodejs8 --trigger-http --memory=128MB --region=YOUR_REGION
- Google Cloud SDK will give you an URL endpoint. Copy and save this URL for the next step.
- Navigate to the repository that you want to send notifications from.
- Settings > WebHooks > Add webhook
- Pick any name
- Paste the URL from your cloud function
- Make a random code change in your repository.
git push
- If everything went alright your Discord bot shows a Commit message.
Optional: Use this page as a guide on how to style your bot message to your liking.
-the end-