{
  "kind": "alaskan.workflow",
  "version": 1,
  "slug": "weekly-pipeline-digest",
  "name": "Weekly pipeline digest",
  "summary": "Every Friday afternoon: deals moved, won and lost, meetings held, and the three deals most at risk with a next step each. Posted where you choose after one look.",
  "for": "Agencies and sales teams",
  "author": {
    "name": "Alaskan Labs"
  },
  "license": "MIT",
  "dog": "denali",
  "trigger": {
    "type": "schedule",
    "when": "fri 15:00"
  },
  "nodes": [
    {
      "id": "deals",
      "type": "app",
      "title": "Read this week's deals",
      "app": "hubspot",
      "action": "HUBSPOT_LIST_DEALS",
      "input": {
        "updated_since": "7 days ago"
      }
    },
    {
      "id": "meetings",
      "type": "app",
      "title": "Count this week's sales meetings",
      "app": "googlecalendar",
      "action": "GOOGLECALENDAR_FIND_EVENT",
      "input": {
        "query": "demo OR intro OR discovery",
        "timeMin": "7 days ago"
      }
    },
    {
      "id": "write",
      "type": "think",
      "title": "Write the digest",
      "prompt": "Write the week's pipeline digest: new deals, stage moves, deals won and lost with their value, meetings held, and the three deals most at risk with one next step each. Plain text, under 200 words. Use only the numbers you were given and say what's missing."
    },
    {
      "id": "approve",
      "type": "decide",
      "kind": "send",
      "title": "Post this week's pipeline digest?",
      "prompt": "{{write}}",
      "options": [
        {
          "key": "post",
          "label": "Post it in #sales"
        },
        {
          "key": "email",
          "label": "Email it to me only"
        },
        {
          "key": "skip",
          "label": "Skip this week",
          "effect": "decline"
        }
      ]
    },
    {
      "id": "post",
      "type": "app",
      "title": "Post the digest in #sales",
      "app": "slack",
      "action": "SLACK_SEND_MESSAGE",
      "write": true,
      "input": {
        "channel": "#sales",
        "markdown_text": "{{write}}"
      }
    },
    {
      "id": "email",
      "type": "app",
      "title": "Email the digest to you",
      "app": "gmail",
      "action": "GMAIL_SEND_EMAIL",
      "write": true,
      "input": {
        "subject": "Pipeline digest, week of {{today}}",
        "body": "{{write}}"
      }
    },
    {
      "id": "save",
      "type": "write",
      "title": "Save the digest"
    }
  ],
  "edges": [
    [
      "deals",
      "meetings"
    ],
    [
      "meetings",
      "write"
    ],
    [
      "write",
      "approve"
    ],
    [
      "approve",
      "post",
      "post"
    ],
    [
      "approve",
      "email",
      "email"
    ],
    [
      "approve",
      "save",
      "skip"
    ],
    [
      "post",
      "save"
    ],
    [
      "email",
      "save"
    ]
  ]
}
