Post GitHub pull request alerts to Slack
A GitHub + Slack agent flow
A pull request that sits unreviewed for two days is usually a pull request nobody noticed. This recipe puts your agent in charge of the noticing. It lists the open PRs on a repo with GitHub's list_pull_requests, filters for the ones still waiting on a human, and posts a short digest into a Slack channel with conversations_add_message. The review queue then shows up where your team already talks, instead of in a tab someone has to remember to open. Because the GitHub server answers a request rather than streaming events, the agent checks on the schedule you give it, and you set how loud it gets: a ping per new PR, or one morning summary of everything still open.
The flow
list_pull_requestsLists pull requests in a repository with filters.
conversations_add_messagePosts a message to a public channel, private channel, or DM.
Step by step
- Pick the repo and the channel
Tell the agent which repository to watch and which channel gets the alerts, plus what needs review means for you: no reviewer assigned yet, or open past the age you care about. Both come straight off the list, where approval state does not.
- List what's open
The agent calls list_pull_requests with a state filter and reads back the open PRs, their authors, and how long each has waited.
- Post the digest
It formats one line per PR with title, author, and link, then sends the message to your channel with conversations_add_message.
Tell your agent
Every weekday at 9am, list the open pull requests on acme/api that have no reviewer assigned, and post them to #eng-reviews as a short list with title, author, age, and link. Skip drafts.
Setup
This flow needs both servers connected to your agent. Follow each install guide:
Worth knowing
- conversations_add_message ships disabled by default on Slack's server. Turn it on, or the agent can read Slack but not post to it.
- list_pull_requests returns drafts alongside ready PRs. Filter them out in the prompt unless you want drafts in the digest.
- GitHub paginates its results. For a busy repo, tell the agent to read every page before it counts what's open, or the digest will run short.
Questions
- Can it alert on a single new PR instead of a digest?
- Yes. Run the agent more often and have it post one message per PR it hasn't seen, keeping a short list of the IDs it already announced so it doesn't repeat.
- Does it need write access to GitHub?
- No. It only reads with list_pull_requests, so a read-scoped token covers the GitHub side. The writing happens in Slack.
- Why not use GitHub's own Slack app?
- You can. This version earns its place when you want the agent to filter or summarize first, for example only PRs touching a directory you own, rather than every event on the repo.