Skip to content
AnswerWell geo Documentation

Research · 8 min read · Answerwell

GitHub Webhooks and Slack Bots: Events, Slash Commands, and Connector Agents

How to route GitHub issue and repo events into Slack with Workers webhooks, slash commands, and Agent API managed connectors.

Most of this page follows Cloudflare Workers tutorials and Cloudflare Agents documentation for hand-built integrations, plus Perplexity Agent API cookbooks for Profile-based agents that use managed GitHub and Slack connectors. The same goal appears in many projects: mirror GitHub activity in a channel, let teammates query issues from Slack, or run an automated investigation and post one structured update.

GitHub webhooks and Slack: which pattern fits your task

Section titled “GitHub webhooks and Slack: which pattern fits your task”

GitHub can POST JSON event payloads to an HTTPS endpoint you control; Slack can receive messages through Incoming Webhooks, respond to Slash Commands, or push Events API traffic to a Worker. A notification bot usually combines a GitHub repository webhook (Issues, Pull requests, or other events) with a Slack Incoming Webhook URL stored as a secret. A lookup bot adds a slash command (for example /issue owner/repo#1) that hits your Worker, calls the GitHub REST API, and returns Block Kit JSON to Slack. An agent workflow replaces most of that glue with one Agent API request, managed connectors, and optional Sandbox git/gh CLI access.

Goal Typical stack Where configuration lives
Post when issues change GitHub webhook → Worker /webhook → Slack Incoming Webhook GitHub Settings → Webhooks; SLACK_WEBHOOK_URL via Wrangler
Look up a public issue from Slack Slack Slash Command → Worker /lookup → GitHub API Slack app Slash Commands; Worker routes
Verify PRs or deploy from Slack GitHub webhook and/or Slack slash command on one Worker Per-repo GitHub webhook; Slack command Request URL
Investigate incident or bug, one Slack reply Perplexity Agent API + Datadog/GitHub/Slack connectors + Sandbox API Portal Profile version; run input only
Conversational AI in DMs and @mentions Cloudflare Agents SDK SlackAgent + OAuth Slack Event Subscriptions; Durable Objects per workspace

Configure GitHub webhooks: Payload URL, events, and secrets

Section titled “Configure GitHub webhooks: Payload URL, events, and secrets”

GitHub webhooks fire only for repositories where you add them. For a Worker at https://myworkerurl.com, point the Payload URL at https://myworkerurl.com/webhook, set Content type to application/json, and under Which events would you like to trigger this webhook? choose Let me select individual events instead of the default push-only behavior.

Go to your GitHub repository’s Settings > Webhooks > Add webhook.

Set the Payload URL to the /webhook path on your Worker URL.

In the Content type dropdown, select application/json.

— Cloudflare, Build a Slackbot

For issue-driven Slack notifications, enable the Issues event type so GitHub sends open, edit, close, and related issue events. For pull request automation (such as a code review bot), restrict the webhook to the test repository and subscribe to Pull requests; locally you can expose the Worker with a tunnel and append /webhook to the public URL.

Configure this webhook on a specific GitHub repository where you will create test pull requests. The bot will only review PRs in repositories where the webhook is configured.

Set Payload URL: Your Cloudflare Tunnel URL from Step 5 with /webhook appended (for example, https://example.trycloudflare.com/webhook)

Set Secret: Same value you used for WEBHOOK_SECRET in your .dev.vars file

— Cloudflare, Build a code review bot

When GitHub should trust the receiver, configure a shared Secret on the webhook and validate X-Hub-Signature-256 in the Worker. The GitHub SMS notifications using Twilio tutorial shows HMAC-SHA256 verification with GITHUB_SECRET_TOKEN from wrangler secret put. For local development, mirror the webhook secret in .dev.vars as WEBHOOK_SECRET; Wrangler loads that file during wrangler dev and it must not be committed.

Slack Incoming Webhook and slash commands on Workers

Section titled “Slack Incoming Webhook and slash commands on Workers”

Create a Slack app at api.slack.com/apps, enable Incoming Webhooks, and Add New Webhook to Workspace for the target channel. The tutorial pairs that URL with GitHub issue webhooks: the Worker parses the GitHub IssueEvent, builds Block Kit blocks, and POSTs JSON to c.env.SLACK_WEBHOOK_URL.

Slash commands send an HTTP POST with application/x-www-form-urlencoded body. Slack includes text (for example cloudflare/wrangler#1), which you parse with c.req.parseBody(), split into owner, repo, and issue_number, and fetch via https://api.github.com/repos/{owner}/{repo}/issues/{issue_number}. Return blocks and optionally response_type: "in_channel" so the answer is visible to the channel, not only the caller.

A Slash Command in Slack is a custom-configured command that can be attached to a URL request. For example, if you configured /weather <zip>, Slack would make an HTTP POST request to a configured URL, passing the text <zip> to get the weather for a specified zip code. In your application, you will use the /issue command to look up GitHub issues using the GitHub API ↗︎.

— Cloudflare, Build a Slackbot

Route layout with Hono on Cloudflare Workers

Section titled “Route layout with Hono on Cloudflare Workers”

Mount child apps with app.route() so /lookup serves Slack slash commands and /webhook serves GitHub:

import { Hono } from "hono";
import lookup from "./routes/lookup";
import webhook from "./routes/webhook";
const app = new Hono();
app.route("/lookup", lookup);
app.route("/webhook", webhook);
export default app;

The webhook handler reads action, issue, and repository from JSON, sets a prefix such as An issue was ${action}:, reuses the same Block Kit builder as lookup, then posts to Slack. Return 200 with body OK so GitHub marks delivery successful; on failure, return 500 so GitHub can retry. The lookup route can use app.onError() to return a plain-text hint when the issue string does not match owner/repo#issue_number.

Related Worker patterns from the same cluster: a /deploy slash command that checks SLACK_VERIFICATION_TOKEN and calls a Deploy Hook URL; SMS instead of Slack via Twilio on the same GitHub webhook path.

Agent API: GitHub and Slack managed connectors with Sandbox

Section titled “Agent API: GitHub and Slack managed connectors with Sandbox”

For incident response or thread replies without maintaining Hono routes, save a Profile in the Perplexity API Portal with Sandbox, Skills, and scoped Datadog, GitHub, and Slack managed connectors. A member launches one POST https://api.perplexity.ai/v1/agent with profile.id, profile.version, and input; the Profile holds model, instructions, and connector credentials.

Profile: Saves the model, instructions, Sandbox, Skill, managed connectors, and agent loop settings under one reusable ID. Every save creates a new version, and a request pins one version.

— Perplexity, Build an incident responder with Profiles, Skills, and Managed Connectors

With Sandbox and GitHub together and no GitHub allowed_tools allowlist, the connector injects credentials into the container so the agent runs git and gh directly; the response shows sandbox_results instead of per-call GitHub mcp_call items.

When the Profile includes both GitHub and Sandbox, the connector makes its credential available inside the container, so the agent runs the git and gh CLIs directly against repositories the connected account can access.

— Perplexity, Build an incident responder with Profiles, Skills, and Managed Connectors

Incident flows typically read Datadog only from connectors (not Slack), clone and git diff release tags in Sandbox, then call slack_send_message once. Bug-triage flows may use slack_read_thread plus Sandbox investigation and reply with thread_ts parsed from a Slack permalink (p1234567890123456 → 1234567890.123456). Restrict Slack tools in the Profile (for example slack_send_message only for notifications-only responders) so Slack is delivery, not evidence, unless the Skill explicitly reads a thread.

Pin production traffic to a fixed Profile version; do not pass effort on Profile-backed requests. Request fields override Profile defaults, and a connector in the request replaces a Profile connector with the same ID. Managed connectors are in preview; see the Connectors guide for Sandbox pairing rules—setting GitHub allowed_tools or approval policy without Sandbox credentials breaks authenticated git/gh in the container.

Communication channels list Slack and Webhooks separately. A classic GitHub→Slack Worker is a webhook integration. A Slack Agent uses the Slack Events API, OAuth install flow, signing-secret verification, and app_mention / message.im to run an AI assistant in DMs and channels, with one Durable Object per workspace for isolated state.

Slack sends events to your Worker through the Slack Events API ↗︎. Your Worker verifies each request, identifies the installed workspace, and routes the event to an agent instance.

— Cloudflare, Slack communication channel

Use webhook-style bots when GitHub (or another system) initiates delivery and you only need notifications or simple commands. Use a Slack Agent when users converse in Slack and you need thread context, multi-workspace tenancy, and model-backed replies. The webhooks channel overview also lists Twilio and email patterns beside Slack bots.

  • Enabling GitHub’s default push-only webhook when you care about Issues or Pull requests.
  • Mismatching GitHub webhook Secret and Worker env (WEBHOOK_SECRET, GITHUB_SECRET_TOKEN).
  • Exposing or committing SLACK_WEBHOOK_URL or Slack signing secrets.
  • Parsing slash commands with c.req.json() instead of parseBody() (application/x-www-form-urlencoded).
  • Enabling GitHub allowed_tools on a Perplexity Profile while expecting Sandbox git diff—that switches GitHub back to MCP-style calls without CLI credentials in Sandbox.
  • Retrying an Agent API run after Slack may have already accepted slack_send_message—inspect the channel first.
  1. In the GitHub repository, open Settings → Webhooks and confirm Recent Deliveries show 200 responses for your Worker’s /webhook URL with the expected event types (Build a Slackbot webhook section).
  2. Trigger a test issue or pull request (per your subscribed events) and confirm the message appears in the intended Slack channel via Incoming Webhook or bot post.
  3. Run your slash command (for example /issue owner/repo#1) and confirm Block Kit output; toggle response_type if only you should see errors.
  4. For Agent API runs, poll GET https://api.perplexity.ai/v1/agent/{id} until status is completed, verify one successful slack_send_message and expected sandbox_results git output (incident responder, triage example).
  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact statement you are asking about.