{
  "flow": [
    {
      "id": 1,
      "module": "telegram:WatchUpdates",
      "version": 1,
      "metadata": {
        "name": "Watch Telegram Button Taps",
        "designer": {
          "x": 0,
          "y": 0
        }
      },
      "parameters": {
        "__IMTHOOK__": null
      }
    },
    {
      "id": 5,
      "mapper": {},
      "module": "builtin:BasicRouter",
      "routes": [
        {
          "flow": [
            {
              "id": 6,
              "filter": {
                "name": "Approved",
                "conditions": [
                  [
                    {
                      "a": "{{1.callback_query.data}}",
                      "b": "approve:",
                      "o": "text:startswith"
                    }
                  ]
                ]
              },
              "mapper": {
                "id": "{{replace(1.callback_query.data; \"approve:\"; \"\")}}",
                "base": "YOUR_AIRTABLE_BASE_ID",
                "table": "YOUR_AIRTABLE_TABLE_ID",
                "useColumnId": false
              },
              "module": "airtable:ActionGetRecord",
              "onerror": [
                {
                  "id": 60,
                  "mapper": {
                    "text": "\u26a0\ufe0f Error in \"Clip Chain \u2014 Approval Handler\" \u2014 Get Clip Record failed: {{6.error.message}}. This run has been saved for automatic retry.",
                    "chatId": "YOUR_TELEGRAM_CHAT_ID"
                  },
                  "module": "telegram:SendReplyMessage",
                  "version": 1,
                  "metadata": {
                    "name": "Alert on Error",
                    "designer": {
                      "x": 600,
                      "y": -300
                    }
                  },
                  "parameters": {
                    "__IMTCONN__": null
                  }
                },
                {
                  "id": 61,
                  "mapper": {
                    "count": 3,
                    "retry": true,
                    "interval": 15
                  },
                  "module": "builtin:Break",
                  "version": 1,
                  "metadata": {
                    "name": "Save for Retry",
                    "designer": {
                      "x": 600,
                      "y": -450
                    }
                  }
                }
              ],
              "version": 3,
              "metadata": {
                "name": "Get Clip Record",
                "designer": {
                  "x": 600,
                  "y": -150
                }
              },
              "parameters": {
                "__IMTCONN__": null
              }
            },
            {
              "id": 7,
              "mapper": {
                "model": "claude-sonnet-5",
                "messages": [
                  {
                    "role": "user",
                    "content": "Write a short, punchy LinkedIn caption (2-4 sentences, at most 3 relevant hashtags, no hashtag spam) for a short video clip. Clip title: \"{{6.YOUR_FIELD_ID}}\". This clip promotes the book 'The 4-Hour Side Hustle.' Write only the caption text, nothing else.",
                    "inputType": "single"
                  }
                ],
                "max_tokens": 300
              },
              "module": "anthropic-claude:createAMessage",
              "onerror": [
                {
                  "id": 70,
                  "mapper": {
                    "text": "\u26a0\ufe0f Error in \"Clip Chain \u2014 Approval Handler\" \u2014 Write Caption failed: {{7.error.message}}. This run has been saved for automatic retry.",
                    "chatId": "YOUR_TELEGRAM_CHAT_ID"
                  },
                  "module": "telegram:SendReplyMessage",
                  "version": 1,
                  "metadata": {
                    "name": "Alert on Error",
                    "designer": {
                      "x": 900,
                      "y": -300
                    }
                  },
                  "parameters": {
                    "__IMTCONN__": null
                  }
                },
                {
                  "id": 71,
                  "mapper": {
                    "count": 3,
                    "retry": true,
                    "interval": 15
                  },
                  "module": "builtin:Break",
                  "version": 1,
                  "metadata": {
                    "name": "Save for Retry",
                    "designer": {
                      "x": 900,
                      "y": -450
                    }
                  }
                }
              ],
              "version": 1,
              "metadata": {
                "name": "Write Caption",
                "designer": {
                  "x": 900,
                  "y": -150
                }
              },
              "parameters": {
                "__IMTCONN__": null
              }
            },
            {
              "id": 8,
              "mapper": {
                "text": "{{7.content[1].text}} {{6.YOUR_FIELD_ID}}",
                "type": "now",
                "shorten": true,
                "useMedia": false,
                "attachment": false,
                "profileIds": [
                  "YOUR_BUFFER_PROFILE_ID"
                ]
              },
              "module": "buffer:ActionCreateStatus",
              "onerror": [
                {
                  "id": 80,
                  "mapper": {
                    "text": "\u26a0\ufe0f Error in \"Clip Chain \u2014 Approval Handler\" \u2014 Post to LinkedIn failed: {{8.error.message}}. This run has been saved for automatic retry.",
                    "chatId": "YOUR_TELEGRAM_CHAT_ID"
                  },
                  "module": "telegram:SendReplyMessage",
                  "version": 1,
                  "metadata": {
                    "name": "Alert on Error",
                    "designer": {
                      "x": 1200,
                      "y": -300
                    }
                  },
                  "parameters": {
                    "__IMTCONN__": null
                  }
                },
                {
                  "id": 81,
                  "mapper": {
                    "count": 3,
                    "retry": true,
                    "interval": 15
                  },
                  "module": "builtin:Break",
                  "version": 1,
                  "metadata": {
                    "name": "Save for Retry",
                    "designer": {
                      "x": 1200,
                      "y": -450
                    }
                  }
                }
              ],
              "version": 2,
              "metadata": {
                "name": "Post to LinkedIn",
                "designer": {
                  "x": 1200,
                  "y": -150
                }
              },
              "parameters": {
                "account": null
              }
            },
            {
              "id": 9,
              "mapper": {
                "id": "{{replace(1.callback_query.data; \"approve:\"; \"\")}}",
                "base": "YOUR_AIRTABLE_BASE_ID",
                "table": "YOUR_AIRTABLE_TABLE_ID",
                "record": {
                  "YOUR_FIELD_1": "Published"
                },
                "typecast": true,
                "useColumnId": false
              },
              "module": "airtable:ActionUpdateRecords",
              "version": 3,
              "metadata": {
                "name": "Mark as Published",
                "designer": {
                  "x": 1500,
                  "y": -150
                }
              },
              "parameters": {
                "__IMTCONN__": null
              }
            },
            {
              "id": 10,
              "mapper": {
                "text": "\u2705 Posted to LinkedIn: {{6.YOUR_FIELD_ID}}",
                "chatId": "YOUR_TELEGRAM_CHAT_ID"
              },
              "module": "telegram:SendReplyMessage",
              "version": 1,
              "metadata": {
                "name": "Confirm Posted",
                "designer": {
                  "x": 1800,
                  "y": -150
                }
              },
              "parameters": {
                "__IMTCONN__": null
              }
            }
          ]
        },
        {
          "flow": [
            {
              "id": 11,
              "filter": {
                "name": "Rejected",
                "conditions": [
                  [
                    {
                      "a": "{{1.callback_query.data}}",
                      "b": "reject:",
                      "o": "text:startswith"
                    }
                  ]
                ]
              },
              "mapper": {
                "id": "{{replace(1.callback_query.data; \"reject:\"; \"\")}}",
                "base": "YOUR_AIRTABLE_BASE_ID",
                "table": "YOUR_AIRTABLE_TABLE_ID",
                "record": {
                  "YOUR_FIELD_1": "Archived"
                },
                "typecast": true,
                "useColumnId": false
              },
              "module": "airtable:ActionUpdateRecords",
              "version": 3,
              "metadata": {
                "name": "Mark as Rejected",
                "designer": {
                  "x": 600,
                  "y": 150
                }
              },
              "parameters": {
                "__IMTCONN__": null
              }
            },
            {
              "id": 12,
              "mapper": {
                "text": "\u274c Clip rejected and archived.",
                "chatId": "YOUR_TELEGRAM_CHAT_ID"
              },
              "module": "telegram:SendReplyMessage",
              "version": 1,
              "metadata": {
                "name": "Confirm Rejected",
                "designer": {
                  "x": 900,
                  "y": 150
                }
              },
              "parameters": {
                "__IMTCONN__": null
              }
            }
          ]
        }
      ],
      "version": 1,
      "metadata": {
        "name": "Route by Decision",
        "designer": {
          "x": 300,
          "y": 0
        }
      }
    }
  ],
  "name": "Clip Chain \u2014 Approval Handler",
  "metadata": {
    "instant": true,
    "version": 1,
    "scenario": {
      "dlq": true
    }
  },
  "scheduling": {
    "type": "immediately"
  }
}