A Rust-based bot that automatically posts updates about the Delta repository to X (Twitter). Based on X tweet: https://x.com/mjovanc/status/1866861106423074952
- Detects and announces new contributors to the Delta repository
- Posts notifications about new releases
- Uses webhook-based architecture for real-time updates
- New Contributor Message:
Delta got a new contributor [Contributor Name]!
Details: [Commit message]
Link: [Commit link]
- New Release Message:
New release ([Version Number]) of Delta out! π
Link to release notes: [Release link]
- Clone the repository
- Set up environment variables:
GITHUB_TOKEN
: GitHub API tokenX_API_KEY
: X (Twitter) API keyX_API_SECRET
: X (Twitter) API secretX_ACCESS_TOKEN
: X (Twitter) access tokenX_ACCESS_SECRET
: X (Twitter) access token secretREPO_OWNER
: The owner of the GitHub repositoryREPO_NAME
: The name of the GitHub repository
- Go to your GitHub account settings
- Navigate to Developer settings > Personal access tokens
- Generate a new token (classic) with the
repo
andadmin:repo_hook
scopes
- Go to your GitHub repository settings
- Navigate to Webhooks > Add webhook
- Enter the webhook URL from the environment variable
WEBHOOK_PATH
- Select the events, "Push" and "Releases" you want to trigger the webhook
- Definition : Webhooks are HTTP callbacks that allow one application to send real-time data to another whenever a specific event occurs.
- Communication : They use a request-response model. When an event occurs, the source application makes an HTTP POST request to a predefined URL (the webhook endpoint) on the target application, sending data about the event.
- Use Case : Commonly used for event-driven architectures where you want to notify another service about events, such as GitHub sending a notification about a new commit or release.
- Example : When a new issue is created in a GitHub repository, GitHub can send a webhook notification to your application to inform it of the new issue.
Get these from the X Developer Portal (https://developer.twitter.com/en/portal/dashboard)
- Go to your X (Twitter) dashboard
- Navigate to your API keys
- Create a new API key
- This bot is tested as the server running on a Local machine with Ubuntu 24.10.
- ngrok, from https://ngrok.com/, is used to expose the webhook URL to the public internet for local development.
- A blank (cargo new bot_test) repo is used for testing for release and push events.
- Example of a tweet for a release: https://x.com/dmbtechdev/status/1868616134259343861
src/
βββ github/ # GitHub API integration
βββ x/ # X API integration
βββ webhook/ # Webhook handling
βββ config/ # Configuration management
https://github.com/dmbtechdev/x-bot