Overview
Add Slack integration for notifications and slash commands.
Webhook Support ✅
Slack provides multiple webhook mechanisms:
Events API
app_mention - Bot mentioned in channel
message - New message in channel
reaction_added - Emoji reaction added
Slash Commands
Custom commands like /pr-agent review <url>
Identification
- Header:
X-Slack-Signature (HMAC SHA256)
- Header:
X-Slack-Request-Timestamp
- Payload: Contains
team_id, api_app_id
- Challenge: URL verification returns
challenge field
Signature Verification
sig_basestring = f"v0:{timestamp}:{body}"
expected = "v0=" + hmac.new(secret, sig_basestring, sha256).hexdigest()
Event Payload
{
"type": "event_callback",
"team_id": "T123",
"api_app_id": "A123",
"event": {
"type": "app_mention",
"user": "U123",
"text": "<@bot> /review https://github.com/...",
"channel": "C123"
}
}
Slash Command Payload
{
"command": "/pr-agent",
"text": "review https://github.com/...",
"response_url": "https://hooks.slack.com/...",
"trigger_id": "xxx",
"user_id": "U123",
"channel_id": "C123"
}
Tasks
Use Cases
- Notifications: Alert channel when PR needs review
- Commands:
/pr-agent review from Slack
- Summaries: Daily PR summary in channel
- Approvals: Approve PRs via Slack buttons
Overview
Add Slack integration for notifications and slash commands.
Webhook Support ✅
Slack provides multiple webhook mechanisms:
Events API
app_mention- Bot mentioned in channelmessage- New message in channelreaction_added- Emoji reaction addedSlash Commands
Custom commands like
/pr-agent review <url>Identification
X-Slack-Signature(HMAC SHA256)X-Slack-Request-Timestampteam_id,api_app_idchallengefieldSignature Verification
Event Payload
{ "type": "event_callback", "team_id": "T123", "api_app_id": "A123", "event": { "type": "app_mention", "user": "U123", "text": "<@bot> /review https://github.com/...", "channel": "C123" } }Slash Command Payload
{ "command": "/pr-agent", "text": "review https://github.com/...", "response_url": "https://hooks.slack.com/...", "trigger_id": "xxx", "user_id": "U123", "channel_id": "C123" }Tasks
/pr-agent review,/pr-agent describe)Use Cases
/pr-agent reviewfrom Slack