ivy: flow/v1
name: Approve before posting
description: Ivy drafts an announcement, you approve it, and only then is it posted.

on:
  manual:
    inputs:
      topic: { type: string, required: true }

steps:
  - id: draft
    name: Draft the announcement
    agent: ivy
    prompt: "Draft a short announcement about: {{ inputs.topic }}"
    output:
      schema: { type: object, required: [text], properties: { text: { type: string } } }
  - id: approval
    name: Ask for approval
    ask:
      to: runner
      question: Post this announcement?
      review: steps.draft.output.text
  - id: post
    name: Post it
    after: { approval: approved }
    post:
      to: { channel: General } # the channel the announcement goes to
      text: "{{ steps.approval.output.value }}"
  - id: not_posted
    name: Say it wasn't posted
    after: { approval: rejected }
    post:
      to: { channel: General }
      text: "The announcement about {{ inputs.topic }} wasn't approved."
