> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rootly.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Workflows

> Use workflow actions in Rootly to create and manage Google Docs for incident retrospectives with Liquid templates, folder placement, and permission controls.

Rootly can automatically generate Google Docs from your templates when incidents are created, updated, or resolved. This page walks through creating a template, sharing it with Rootly, and wiring it up in a workflow.

## Step 1: Create Your Template Document

<Note>
  You create **one template document** with Liquid variable placeholders. Each time the workflow fires, Rootly copies that template and replaces the variables with real incident data — so you never manually copy-paste incident details again.
</Note>

### Create the Document

<Steps>
  <Step title="Open Google Drive and create a new Google Doc">
    Go to **New → Google Docs**. Give it a clear, descriptive name so it's easy to find later — for example:

    * "Rootly Retrospective Template"
    * "Executive Summary Template"
    * "Incident Runbook Template"

    <Frame>
      <img alt="Create new Google Doc in Google Drive" src="https://mintcdn.com/rootly/_PUAvUAOiRXFH78z/images/integrations/google-docs/installation/image-15.png?fit=max&auto=format&n=_PUAvUAOiRXFH78z&q=85&s=289708fd238510d15484b9f34abf35a5" width="357" height="431" data-path="images/integrations/google-docs/installation/image-15.png" />
    </Frame>
  </Step>

  <Step title="Add structure and Liquid variables">
    Design your document the way you'd want every generated doc to look. Use Liquid variables anywhere you want incident data to appear. See the template examples below for a starting point.
  </Step>
</Steps>

### Template Examples

<Tabs>
  <Tab title="Standard Retrospective">
    ```liquid theme={null}
    # Retrospective: {{ incident.title }}

    **Date:** {{ incident.started_at | date: "%B %d, %Y" }}
    **Severity:** {{ incident.severity }}
    **Status:** {{ incident.status }}

    ## What Happened
    {{ incident.summary }}

    ## Timeline
    - Started: {{ incident.started_at | date: "%I:%M %p" }}
    - Mitigated: {{ incident.mitigated_at | date: "%I:%M %p" | default: "In progress" }}
    - Resolved: {{ incident.resolved_at | date: "%I:%M %p" | default: "In progress" }}
    - Total Duration: {{ incident.duration | divided_by: 60 }} minutes

    ## Services Affected
    {{ incident.services | join: ", " }}

    ## Team
    - Created By: {{ incident.creator.name }}

    ## Communication
    Slack Channel: #{{ incident.slack_channel_name }}
    ```
  </Tab>

  <Tab title="Detailed Retrospective">
    ```liquid theme={null}
    # Retrospective: {{ incident.title }}

    ## Incident Overview
    - **ID:** #{{ incident.id }}
    - **Date:** {{ incident.started_at | date: "%B %d, %Y" }}
    - **Duration:** {{ incident.duration | divided_by: 3600 }} hours {{ incident.duration | modulo: 3600 | divided_by: 60 }} minutes
    - **Severity:** {{ incident.severity }}

    ## Summary
    {{ incident.summary }}

    ## Impact
    - **Services:** {{ incident.services | join: ", " }}
    - **Groups:** {% for group in incident.groups %}{{ group.name }}{% unless forloop.last %}, {% endunless %}{% endfor %}
    - **Environments:** {{ incident.environments | join: ", " }}

    ## Timeline of Events
    {{ incident.timeline_table_markdown }}

    ## Root Cause Analysis
    [To be completed during review]

    ## What Went Well
    - [Add items]

    ## What Could Be Improved
    - [Add items]

    ## Action Items
    [To be added during review]

    ## Participants
    {% for role in incident.roles %}
    {%- if role.user -%}
    - {{ role.incident_role.name }}: {{ role.user.full_name }}
    {%- else -%}
    - {{ role.incident_role.name }}: Unassigned
    {%- endif -%}
    {% endfor %}
    ```
  </Tab>

  <Tab title="Executive Summary">
    ```liquid theme={null}
    # Executive Brief: {{ incident.title }}

    **Incident Duration:** {{ incident.duration | divided_by: 60 }} minutes
    **Customer Impact:** [To be assessed]

    ## What Happened
    {{ incident.summary }}

    ## Current Status
    {{ incident.status }} as of {{ "now" | date: "%I:%M %p" }}

    ## Services Affected
    {{ incident.services | join: ", " }}

    ## Next Steps
    1. [Add next steps]
    2. [Add next steps]

    **Created By:** {{ incident.creator.name }}
    **Full Report:** {{ incident.url }}
    ```
  </Tab>
</Tabs>

### Common Liquid Variables

<Tip>
  For the full variable reference, see [Rootly's Liquid documentation](https://docs.rootly.com/liquid/incident-variables). Use the [Liquid Variable Explorer](https://rootly.com/account/help/liquid-explorer) to test variables against real incident data before committing them to your template.
</Tip>

```liquid theme={null}
# Basic Info
{{ incident.id }}                  # Incident ID
{{ incident.title }}               # Title
{{ incident.summary }}             # Description
{{ incident.severity }}            # SEV1, SEV2, etc.
{{ incident.status }}              # Current status

# Timestamps
{{ incident.started_at }}          # Start time
{{ incident.mitigated_at }}        # Mitigation time
{{ incident.resolved_at }}         # Resolution time
{{ incident.duration }}            # Duration in seconds

# People
{{ incident.creator.name }}        # Creator name
{{ incident.creator.email }}       # Creator email

# Services & Groups
{{ incident.services }}            # Array of services
{{ incident.groups }}              # Array of groups (teams)
{{ incident.environments }}        # Array of environments

# Communication
{{ incident.slack_channel_name }}  # Slack channel
{{ incident.url }}                 # Rootly incident URL
```

## Step 2: Share Your Template with Rootly

Before Rootly can use your template, it needs read access to the document.

<Tabs>
  <Tab title="OAuth Users">
    Nothing to do here — the Google account you connected in the installation step already has access to documents you own.
  </Tab>

  <Tab title="Service Account Users">
    You need to explicitly share the template with the service account email.

    <Steps>
      <Step title="Find your service account email">
        The email follows the pattern `name@project.iam.gserviceaccount.com`. You can find it in Google Cloud Console under **IAM & Admin → Service Accounts**.

        <Frame>
          <img alt="Service account email in Google Cloud Console" src="https://mintcdn.com/rootly/_PUAvUAOiRXFH78z/images/integrations/google-docs/installation/image-17.png?fit=max&auto=format&n=_PUAvUAOiRXFH78z&q=85&s=dd976e45eff2f35f9ac16f06fb50a507" width="381" height="151" data-path="images/integrations/google-docs/installation/image-17.png" />
        </Frame>
      </Step>

      <Step title="Share the template with the service account">
        Open your template document, click **Share**, add the service account email, and set the permission to **Editor**.

        <Frame>
          <img alt="Share button in Google Docs" src="https://mintcdn.com/rootly/_PUAvUAOiRXFH78z/images/integrations/google-docs/installation/image-18.png?fit=max&auto=format&n=_PUAvUAOiRXFH78z&q=85&s=2d53fa232dd6a6679448f56a2554ac76" width="399" height="61" data-path="images/integrations/google-docs/installation/image-18.png" />
        </Frame>

        <Frame>
          <img alt="Add service account email to share dialog" src="https://mintcdn.com/rootly/_PUAvUAOiRXFH78z/images/integrations/google-docs/installation/image-19.png?fit=max&auto=format&n=_PUAvUAOiRXFH78z&q=85&s=f118727b4179a03352ffe10c474b764e" width="511" height="413" data-path="images/integrations/google-docs/installation/image-19.png" />
        </Frame>

        <Frame>
          <img alt="Set Editor permission for service account" src="https://mintcdn.com/rootly/_PUAvUAOiRXFH78z/images/integrations/google-docs/installation/image-20.png?fit=max&auto=format&n=_PUAvUAOiRXFH78z&q=85&s=4a41b3ed888cab944a6abef182eb1053" width="508" height="434" data-path="images/integrations/google-docs/installation/image-20.png" />
        </Frame>
      </Step>
    </Steps>

    <Warning>
      The permission must be **Editor**, not Viewer or Commenter. Rootly needs write access to copy and populate the template — anything less will cause workflow failures.
    </Warning>
  </Tab>
</Tabs>

## Step 3: Create a Workflow

With the template ready and shared, create a workflow that triggers document generation automatically.

<Steps>
  <Step title="Navigate to Workflows and create a new workflow">
    Go to **Rootly → Workflows → Create Workflow**.

    <Frame>
      <img alt="Rootly Workflows page" src="https://mintcdn.com/rootly/_PUAvUAOiRXFH78z/images/integrations/google-docs/installation/image-21.png?fit=max&auto=format&n=_PUAvUAOiRXFH78z&q=85&s=a0dab3643204cc8c3621dc08f9949f95" width="894" height="325" data-path="images/integrations/google-docs/installation/image-21.png" />
    </Frame>
  </Step>

  <Step title="Select a trigger">
    Choose the event that should kick off document creation:

    * **Incident** — triggers on incident events like creation or resolution
    * **Retrospective** — triggers when retrospective status changes
    * **Action Item** — for follow-up documentation

    <Frame>
      <img alt="Workflow trigger type selection" src="https://mintcdn.com/rootly/_PUAvUAOiRXFH78z/images/integrations/google-docs/installation/image-23.png?fit=max&auto=format&n=_PUAvUAOiRXFH78z&q=85&s=82fb17112fcea41e830fc36c0d77a1da" width="1365" height="630" data-path="images/integrations/google-docs/installation/image-23.png" />
    </Frame>
  </Step>

  <Step title="Add a Google Docs action">
    Click **Add Action → Google Docs → Create Doc**.

    <Frame>
      <img alt="Add Action button in workflow editor" src="https://mintcdn.com/rootly/_PUAvUAOiRXFH78z/images/integrations/google-docs/installation/image-24.png?fit=max&auto=format&n=_PUAvUAOiRXFH78z&q=85&s=c57122cb786eb3a210bac7d441fca650" width="677" height="221" data-path="images/integrations/google-docs/installation/image-24.png" />
    </Frame>

    <Frame>
      <img alt="Google Docs Create Doc action selected" src="https://mintcdn.com/rootly/_PUAvUAOiRXFH78z/images/integrations/google-docs/installation/image-25.png?fit=max&auto=format&n=_PUAvUAOiRXFH78z&q=85&s=096cc44fafba9f6c8337af3c2287b3bd" width="895" height="594" data-path="images/integrations/google-docs/installation/image-25.png" />
    </Frame>
  </Step>

  <Step title="Select your template">
    Choose the template document you created in Step 1 from the dropdown.

    <Frame>
      <img alt="Select template document dropdown" src="https://mintcdn.com/rootly/_PUAvUAOiRXFH78z/images/integrations/google-docs/installation/image-26.png?fit=max&auto=format&n=_PUAvUAOiRXFH78z&q=85&s=449427589eabed62317c246e44f62754" width="466" height="100" data-path="images/integrations/google-docs/installation/image-26.png" />
    </Frame>
  </Step>

  <Step title="Configure the workflow settings">
    Set any additional options — a descriptive name, conditions to filter which incidents trigger the workflow, and a destination folder in Google Drive.

    <Frame>
      <img alt="Workflow configuration settings" src="https://mintcdn.com/rootly/_PUAvUAOiRXFH78z/images/integrations/google-docs/installation/image-27.png?fit=max&auto=format&n=_PUAvUAOiRXFH78z&q=85&s=fa1ff624ca17cc173b7f518952a1144b" width="869" height="534" data-path="images/integrations/google-docs/installation/image-27.png" />
    </Frame>
  </Step>

  <Step title="Activate the workflow">
    Save and toggle the workflow to active. It will fire on the next matching event.
  </Step>
</Steps>

## Configuration Reference

| Setting         | Description                                      | Example                                |
| --------------- | ------------------------------------------------ | -------------------------------------- |
| **Template**    | The Google Doc to use as the source template     | Select from dropdown                   |
| **Trigger**     | When to generate a document                      | Incident Created, Incident Resolved    |
| **Conditions**  | Optional filters to narrow which incidents apply | `Severity = SEV1`, `Duration > 30 min` |
| **Folder**      | Where to save the generated doc in Drive         | `/Incidents/2024`                      |
| **Permissions** | Who can access the generated doc                 | Domain, Team, Private                  |
| **Delay**       | Wait before generating                           | 24 hours (useful for retrospectives)   |

## Troubleshooting

<AccordionGroup>
  <Accordion title="Document wasn't created" icon="circle-xmark">
    * Is the workflow toggled to active?
    * Does the incident meet all the workflow conditions?
    * Is your template shared with Rootly? (Service Account only)
    * Check the workflow execution log for errors
  </Accordion>

  <Accordion title="Variables aren't being replaced" icon="code">
    * Double-check variable spelling — Liquid is case-sensitive
    * Test the variable in the [Liquid Explorer](https://rootly.com/account/help/liquid-explorer)
    * Make sure the field has data on the incident (e.g., `mitigated_at` won't exist on an unmitigated incident)
    * Use `| default: "N/A"` to handle missing values gracefully
  </Accordion>

  <Accordion title="Permission errors during document creation" icon="ban">
    * OAuth: Re-authenticate if your access token has expired
    * Service Account: Confirm the template is shared with the service account as **Editor**
    * Confirm domain-wide delegation is still active in Google Admin
  </Accordion>

  <Accordion title="Document saved to the wrong folder" icon="folder-open">
    * Folder paths use forward slashes — confirm the path is correct
    * Parent folders must already exist in Drive; Rootly won't create them
    * Test any Liquid expressions in the folder path separately
  </Accordion>
</AccordionGroup>

## Best Practices

* **Test with a real incident** before relying on the workflow in production
* **One template per document type** — keep retrospective, runbook, and executive summary templates separate
* **Use `| default:` for optional fields** so missing data doesn't leave blank placeholders in your docs
* **Version your templates** by keeping a dated copy before making significant changes

## Next Steps

<CardGroup cols={2}>
  <Card title="Test Your Workflow" icon="flask">
    Create a test incident to confirm the workflow fires and the document generates correctly
  </Card>

  <Card title="Liquid Explorer" icon="code" href="https://rootly.com/account/help/liquid-explorer">
    Test Liquid variables against real incident data before adding them to your template
  </Card>
</CardGroup>
