Sign inSign up

zeigren/benzaiten

By zeigren

•Updated about 5 years ago

A Webhook Relay Message Bot Thing

Image
0

1.3K

zeigren/benzaiten repository overview

⁠A Webhook Relay Message Bot Thing

This is a couple of very rough python scripts that currently parse webhooks from Phabricator and Docker Hub, it then creates a message from that information and passes it on. Currently it sends the message to a Discord webhook and saves it as a json file. When parsing the Phabricator webhook it requests more information via the Conduit API. It currently supports Diffusion Commits, Differential Revisions, and Maniphest Tasks.

⁠Setup

⁠Phabricator
  • Create a webhook and whatever rules to trigger it in Phabricator⁠
  • Set the webhook link to http://yourserver:9000/hooks/phabricator
  • Create a Phabricator API token for Conduit⁠
⁠Docker Hub
  • Create a webhook for your Docker Hub repository and set the webhook link to http://yourserver:9000/hooks/dockerhub
⁠Discord
⁠Docker
  • Set a few environment variables in docker-compose.yml namely:
    • PHABRICATOR_URL - URL for the Phabricator instance
    • PHABRICATOR_TOKEN - Conduit API token
    • DISCORD_URL - Discord webhook URL
  • Run docker-compose up -d

⁠Theory of Operation

This uses Adnanh Webhook⁠ for incoming webhooks. It weakly/barely authenticates the webhook, parses the json body for specific info, and passes that off to the relevant python script.

phabricator.py will query Phabricator via a Conduit API wrapper⁠ for more information and bundle that into a message.

dockerhub.py takes the Docker Hub information and bundles it into a message.

webactivity.py is used to save messages to json files.

Discord notifications are sent using a Discord webhook API wrapper⁠.

⁠Docker Image

The Docker image is Alpine based and created using a multi-stage build in order to minimize its size. The Docker image is based on the one by almir⁠.

⁠Resources

The webhook examples folder has some examples of different webhooks to use for testing.

Webhook test site⁠

Discord webhook visualizer⁠

Postman⁠

DockerHub Webhooks⁠

Tag summary

Content type

Image

Digest

Size

27.7 MB

Last updated

about 5 years ago

docker pull zeigren/benzaiten