Draft Better Stack incident postmortems in Google Docs

Whenever Better Stack resolves an incident that lasted more than five minutes, get a Google Doc postmortem draft in your Drive and a Slack ping for the on-call engineer to finish it.

Agentic Task
Better StackGoogle DocsSlack BotEngineeringOperationsNotifications & AlertsAI Reports
PromptCreate

Trigger: an outgoing webhook from Better Stack that fires when an incident is marked as resolved. The webhook payload carries the incident id.

First check: only run if the incident lasted longer than five minutes. Compute duration from the incident's started_at and resolved_at timestamps. If it is five minutes or shorter, exit silently so quick flaps do not create postmortem docs.

Gather everything about the incident from Better Stack. Use Get Incident to fetch the resolved incident (summary, cause, started_at, resolved_at, acknowledged_by, affected monitor id, url). Use List Incident Timeline to pull every timeline event. Use List Incident Comments to pull every comment. Use Get Monitor on the affected monitor to grab its name, url, monitor type, and configuration. Use Get Monitor Response Times over the outage window (from started_at to resolved_at) so the postmortem can describe how latency behaved during the incident.

Create the postmortem in Google Docs. Call Create Document with a title of the form "Postmortem: <incident summary> — <resolution date>". Then call Batch Update Document to insert the body in this order: (1) Summary — two or three sentences of what happened. (2) Impact — total duration, which monitor was affected, and a customer-facing severity call. (3) Timeline — translate the raw Better Stack timeline events and comments into plain-English bullets in chronological order. (4) Hypothesized root cause — draw on the incident cause field, the timeline, comments, and the response-time trend during the window. (5) What went well. (6) What did not go well. (7) Proposed action items as a checkbox or bulleted list. Insert requests from the highest index to the lowest so offsets do not shift.

Announce the doc in Slack. Identify the on-call engineer who owned the incident from the acknowledged_by field on the incident (or from the timeline if that is where the owner appears). Use Slack Bot's Look Up User by Email to resolve that engineer's Slack user id. Then Send a Message to the incidents Slack channel with the Google Doc link and a Slack mention of that engineer so they know the draft is theirs to finish. If the engineer's email cannot be found in Slack, still post the message with the doc link — just drop the personal tag rather than fail the run.

Guardrails: always create a brand-new Google Doc per incident so no prior postmortem is overwritten. Never mark the doc as finalized — this is a first draft only. Do not post to Slack if creating the Google Doc failed.

Additional information

What does this prompt do?
  • Runs automatically the moment Better Stack marks an incident as resolved, so postmortem drafting never gets deferred and forgotten.
  • Pulls the incident details, its full timeline, and every comment, plus the affected monitor and its response-time trend during the outage window.
  • Creates a new Google Doc titled with the incident summary and date, pre-filled with your standard postmortem structure: summary, impact, plain-English timeline, hypothesized root cause, what went well, what did not, and proposed action items.
  • Drops the doc link in your incidents Slack channel and tags the on-call engineer who owned the incident so they know it is theirs to flesh out.
  • Skips any incident that lasted five minutes or less, so flappy monitors do not fill your Drive with postmortem stubs.
What do I need to use this?
  • A Better Stack Uptime account that can send outgoing webhooks when incidents resolve
  • A Google account with permission to create documents in the Drive folder where your engineering docs live
  • A Slack workspace and the channel where you want incident postmortem links to land
How can I customize it?
  • Change the five-minute duration threshold to whatever qualifies as a real incident for your team
  • Edit the postmortem template sections and headings to match the format your team already uses
  • Point the Slack notification at a different channel, or tag a user group instead of a single engineer

Frequently asked questions

Will a doc be created for every Better Stack incident?
No. The workflow only runs for incidents that lasted longer than five minutes. Anything shorter is treated as a blip and skipped, so brief flaps do not spam your Drive.
Does this publish a finished postmortem, or just a draft?
It is always a draft. The doc is pre-filled with the facts, the plain-English timeline, and a hypothesized root cause, but the on-call engineer still owns confirming the cause and finalizing the action items.
Where does the Google Doc end up?
It is created in the Drive of the Google account you connect. You can move it into a shared team folder afterwards, or connect a Google account that already has that folder as its default.
Better Stack has its own postmortem feature. Why use this instead?
Better Stack's built-in postmortem lives inside Better Stack. This workflow puts the draft in your own Google Drive alongside every other engineering doc, and it follows your team's template rather than a generic one.
What if the on-call engineer cannot be matched in Slack?
The workflow still posts the doc link in your incidents channel. It just drops the personal tag rather than fail the whole run, so the notification never gets lost.

Stop losing incident learnings to the busy week after.

Every resolved incident lands as a ready-to-edit postmortem doc, so the follow-up work actually happens instead of falling off the list.