{
  "name": "Post to social media from a webhook (Ampost app)",
  "flow": [
    {
      "id": 1,
      "module": "gateway:CustomWebHook",
      "version": 1,
      "parameters": {
        "hook": null,
        "maxResults": 1
      },
      "mapper": {},
      "metadata": {
        "designer": {
          "x": 0,
          "y": 0
        }
      }
    },
    {
      "id": 2,
      "module": "ampost:createPost",
      "version": 1,
      "parameters": {
        "__IMTCONN__": null
      },
      "mapper": {
        "targets": [
          {
            "platforms": [
              "bluesky",
              "threads"
            ]
          }
        ],
        "text": "{{1.text}}",
        "linkUrl": "{{ifempty(1.link; null)}}",
        "when": "now",
        "Idempotency-Key": "webhook-{{ifempty(1.id; md5(1.text))}}"
      },
      "metadata": {
        "designer": {
          "x": 600,
          "y": 0
        }
      }
    },
    {
      "id": 3,
      "module": "gateway:WebhookRespond",
      "version": 1,
      "parameters": {},
      "mapper": {
        "body": "{\"postId\": \"{{2.id}}\", \"status\": \"{{2.status}}\"}",
        "status": "200",
        "headers": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ]
      },
      "metadata": {
        "designer": {
          "x": 900,
          "y": 0
        }
      }
    }
  ],
  "metadata": {
    "instant": true,
    "version": 1,
    "designer": {
      "orphans": []
    },
    "scenario": {
      "dlq": false,
      "slots": null,
      "dataloss": false,
      "maxErrors": 3,
      "autoCommit": true,
      "roundtrips": 1,
      "sequential": false,
      "confidential": false,
      "freshVariables": false,
      "autoCommitTriggerLast": true
    }
  }
}
