Next Review + Slack & Teams: Event-Driven PR Reminders on AWS
How to extend the Next Review AWS architecture using DynamoDB Streams and AWS Lambda to push smart, role-aware PR notifications to your team's chat channels without creating alert fatigue.
In my previous post, I introduced Next Review , a Chrome extension designed to solve a universal developer headache: pull request reviews dying in chat. By moving the PR queue into the browser, teams get a shared, role-aware space that is quiet by default and loud when it matters.
The core philosophy of Next Review is that manual chat pings are a terrible workflow. When someone pastes a GitHub or GitLab link into Slack, it gets lost. The extension fixes this by relying on native desktop reminders driven by a Manifest V3 background service worker.
However, chat isn't going anywhere. While we don't want developers manually pasting URLs and begging for reviews, a centralized team channel is still the heartbeat of a squad. Since Next Review abstracts its backend behind a
DatabaseServiceContract, mapping the tool to an AWS backend—specifically Amazon DynamoDB—unlocks a powerful feature: event-driven, automated chat integrations via DynamoDB Streams and AWS Lambda.Here is how you can extend Next Review’s AWS architecture to push smart, state-aware notifications to Slack or Microsoft Teams, without reverting to the spammy anti-patterns we built the extension to escape.
The Goal: Smart Pings, Not Chat Spam
Next Review is built around role-based actions. Authors can click Notify to ping the queue when they have applied feedback, and reviewers can mark a PR as Done Review.
Next Review is built around role-based actions. Authors can click Notify to ping the queue when they have applied feedback, and reviewers can mark a PR as Done Review.
When an author clicks Notify, the extension updates the
last_pinged_at timestamp in the database. Currently, the service worker detects this and triggers a chrome.notifications desktop toast.Our goal for this AWS integration is to capture that exact database event and fan it out to a Slack or Teams webhook.
- The Rule: The bot should only message the channel when the author explicitly clicks "Notify", or when a new PR is enqueued.
- The Anti-Rule: The bot must never nag the channel automatically on a timer. The browser owns recurring reminders; the backend owns truth.
The AWS Architecture Extension
In the AWS mapping for Next Review, the shared queue of PRs and the per-person review state live in Amazon DynamoDB. To integrate Slack or Teams, we simply attach a reactionary compute layer to our data store.
In the AWS mapping for Next Review, the shared queue of PRs and the per-person review state live in Amazon DynamoDB. To integrate Slack or Teams, we simply attach a reactionary compute layer to our data store.
1. Enable DynamoDB Streams
The first step is enabling DynamoDB Streams on your
The first step is enabling DynamoDB Streams on your
prs and interactions tables. A stream captures a time-ordered sequence of item-level modifications.When a developer clicks Enqueue or Notify in the extension popup, the AppSync adapter writes those changes to DynamoDB. The stream captures the
INSERT (new PR) or MODIFY (updated last_pinged_at) event.2. AWS Lambda as the Router
We deploy an AWS Lambda function triggered by the DynamoDB Stream. This function acts as our event filter and payload formatter.
We deploy an AWS Lambda function triggered by the DynamoDB Stream. This function acts as our event filter and payload formatter.
Because the Next Review database contract separates the PRs (the card itself) from the interactions (per-person review state), the Lambda function will evaluate the incoming stream record:
- If
eventNameisINSERTon the PR table, it formats a "New PR Enqueued" message. - If
eventNameisMODIFYand thelast_pinged_atvalue changed, it formats a "PR Ready for Second Look" message.
3. Delivery via Webhooks
Once the event is validated, the Lambda function executes an HTTPS POST request to your pre-configured Slack Incoming Webhook or Microsoft Teams Incoming Webhook.
Once the event is validated, the Lambda function executes an HTTPS POST request to your pre-configured Slack Incoming Webhook or Microsoft Teams Incoming Webhook.
Implementation: The Lambda Logic
Here is a conceptual Node.js snippet for the Lambda function handling the stream:
Here is a conceptual Node.js snippet for the Lambda function handling the stream:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
export const handler = async (event) => {
for (const record of event.Records) {
// 1. Capture new PRs entering the queue
if (record.eventName === 'INSERT') {
const prData = record.dynamodb.NewImage;
await sendToChat({
title: "New PR in the Queue",
message: `${prData.author.S} enqueued: ${prData.title.S}`,
url: prData.url.S
});
}
// 2. Capture explicit "Notify" pings from the author
if (record.eventName === 'MODIFY') {
const oldImage = record.dynamodb.OldImage;
const newImage = record.dynamodb.NewImage;
// Only trigger if last_pinged_at was updated
if (oldImage.last_pinged_at?.S !== newImage.last_pinged_at?.S) {
await sendToChat({
title: "PR Needs Another Look",
message: `${newImage.author.S} requested a re-review on: ${newImage.title.S}`,
url: newImage.url.S
});
}
}
}
};
async function sendToChat(payload) {
// Construct your Slack Block Kit or Teams Adaptive Card here
// and fetch(WEBHOOK_URL, { method: 'POST', body })
}
Why This Architecture Wins
- The Extension Remains Lightweight: The React and TypeScript popup never imports a vendor client or a Slack SDK. It doesn't even know Slack exists. It simply fulfills the
DatabaseServiceContractby updating the database. - True Event-Driven Behavior: By relying on DynamoDB Streams, we guarantee that the chat notification only fires when the actual database state changes. If a network error prevents the PR from saving, the chat channel stays silent.
- Preserving Role-Aware Rules: Because the Lambda only listens for the
last_pinged_atmodification, we maintain Next Review's strict role boundaries. A reviewer cannot accidentally trigger a chat ping for someone else's PR, because the extension UI only allows the author to click the Notify button.
Next Review was built to stop the endless cycle of "I'll look after lunch" by moving the queue out of the chat timeline and into a persistent browser state. By carefully layering AWS Lambda and DynamoDB Streams behind your AppSync endpoint, you can bring the absolute most important alerts back into Slack or Teams, while keeping the noise down and the workflow clean.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article