{
  "name": "ASHDOCS — Airtable record to invoice PDF by email",
  "flow": [
    {
      "id": 1,
      "module": "airtable:TriggerWatchRecords",
      "version": 3,
      "parameters": {},
      "mapper": {},
      "metadata": {
        "designer": { "x": 0, "y": 0 },
        "notes": "After import: connect your Airtable account, then pick the base, table and a created-time trigger field."
      }
    },
    {
      "id": 2,
      "module": "http:ActionSendData",
      "version": 3,
      "parameters": { "handleErrors": false, "useNewZLibDeCompress": true },
      "mapper": {
        "url": "https://www.ashdocs.com/api/v1/tools/html-to-pdf",
        "method": "post",
        "headers": [
          { "name": "X-API-Key", "value": "YOUR_API_KEY" },
          { "name": "Content-Type", "value": "application/json" }
        ],
        "qs": [],
        "bodyType": "raw",
        "contentType": "application/json",
        "data": "{\"html\": \"<h1>Invoice {{1.id}}</h1><p>Amount: {{1.fields.Amount}}</p>\", \"options\": {\"format\": \"A4\", \"output\": \"url\"}}",
        "timeout": "300",
        "shareCookies": false,
        "ca": "",
        "rejectUnauthorized": true,
        "followRedirect": true,
        "useQuerystring": false,
        "gzip": true,
        "useMtls": false,
        "parseResponse": true,
        "authUser": "",
        "authPass": "",
        "followAllRedirects": false,
        "serializeUrl": false
      },
      "metadata": {
        "designer": { "x": 300, "y": 0 },
        "notes": "Replace YOUR_API_KEY with your key (sandbox keys run free). Edit the HTML to use your own Airtable field names."
      }
    },
    {
      "id": 3,
      "module": "email:ActionSendEmail",
      "version": 7,
      "parameters": { "saveAfterSent": false },
      "mapper": {
        "to": ["billing@example.com"],
        "subject": "Invoice PDF for record {{1.id}}",
        "contentType": "html",
        "html": "<p>The invoice PDF is ready:</p><p><a href=\"{{2.data.file_url}}\">Download the PDF</a> (link valid for 60 minutes)</p>",
        "attachments": []
      },
      "metadata": {
        "designer": { "x": 600, "y": 0 },
        "notes": "Reconnect your email account after import and set the recipient."
      }
    }
  ],
  "metadata": {
    "instant": false,
    "version": 1,
    "scenario": {
      "roundtrips": 1,
      "maxErrors": 3,
      "autoCommit": true,
      "autoCommitTriggerLast": true,
      "sequential": false,
      "confidential": false,
      "dataloss": false,
      "dlq": false,
      "freshVariables": false
    },
    "designer": { "orphans": [] }
  }
}
