{
 "name": "Missed-call text-back via Twilio (AutomateRecipes)",
 "nodes": [
  {
   "parameters": {
    "httpMethod": "POST",
    "path": "missed-call",
    "responseMode": "onReceived",
    "options": {}
   },
   "id": "9e7a03f0-7e1b-5ae5-a378-ae42962ff81b",
   "name": "Twilio call-status webhook",
   "type": "n8n-nodes-base.webhook",
   "typeVersion": 2,
   "position": [
    0,
    0
   ],
   "webhookId": "missed-call"
  },
  {
   "parameters": {},
   "id": "17ef7b1a-39a9-5cd2-a758-16f72393456d",
   "name": "Run manually (test)",
   "type": "n8n-nodes-base.manualTrigger",
   "typeVersion": 1,
   "position": [
    0,
    200
   ]
  },
  {
   "parameters": {
    "jsCode": "return [{json:{body:{From:'+966500000001',To:'+15550001111',CallStatus:'no-answer'}}},{json:{body:{From:'+966500000002',To:'+15550001111',CallStatus:'completed'}}}];"
   },
   "id": "626d8473-5e26-5011-ae3d-bd501157ddfe",
   "name": "Sample missed call",
   "type": "n8n-nodes-base.code",
   "typeVersion": 2,
   "position": [
    220,
    200
   ]
  },
  {
   "parameters": {
    "jsCode": "const missed=['no-answer','busy','failed','canceled'];return $input.all().map(i=>i.json.body||i.json).filter(b=>missed.includes(String(b.CallStatus||'').toLowerCase())&&b.From).map(b=>({json:{caller:b.From,ourNumber:b.To,status:b.CallStatus}}));"
   },
   "id": "dbf2b4f8-8052-521b-a906-a0af96b88787",
   "name": "Only missed calls",
   "type": "n8n-nodes-base.code",
   "typeVersion": 2,
   "position": [
    440,
    100
   ]
  },
  {
   "parameters": {
    "from": "={{ $json.ourNumber }}",
    "to": "={{ $json.caller }}",
    "message": "Sorry we missed your call! How can we help? Reply here and we'll get back to you shortly.",
    "options": {}
   },
   "id": "e4a98b0a-0dac-53be-a42a-4107aaa686a1",
   "name": "Twilio: text the caller",
   "type": "n8n-nodes-base.twilio",
   "typeVersion": 1,
   "position": [
    660,
    100
   ]
  }
 ],
 "connections": {
  "Twilio call-status webhook": {
   "main": [
    [
     {
      "node": "Only missed calls",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Run manually (test)": {
   "main": [
    [
     {
      "node": "Sample missed call",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Sample missed call": {
   "main": [
    [
     {
      "node": "Only missed calls",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Only missed calls": {
   "main": [
    [
     {
      "node": "Twilio: text the caller",
      "type": "main",
      "index": 0
     }
    ]
   ]
  }
 },
 "active": false,
 "settings": {
  "executionOrder": "v1"
 },
 "pinData": {}
}