{
  "name": "Trevilo: emergency enquiry to on-call alert",
  "nodes": [
    {
      "parameters": {
        "content": "## Trevilo: emergency enquiry to on-call alert\n\n1. Open **Trevilo enquiry**, copy the **Production URL**.\n2. In **Trevilo enquiry**, create a **Header Auth** credential: name `X-Webhook-Key`, value a long random key.\n3. In Trevilo, add a rule with keyword conditions for your emergencies (for example burst, flood, leak, no power, urgent) and send it to an n8n connection with that URL. Set its login to **API key in a header**, header name `X-Webhook-Key`, and the same key.\n4. In **Text the on-call person**, create a **Twilio** credential, then set **From** to your Twilio number and **To** to the on-call mobile.\n5. Publish, then send a test enquiry containing one of your words.",
        "height": 420,
        "width": 460
      },
      "id": "068925f6-b819-5446-a943-89ef882246c1",
      "name": "Setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -560,
        -280
      ]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "trevilo-emergency-alert",
        "authentication": "headerAuth",
        "options": {}
      },
      "id": "e0f3d60e-648b-5dad-9dc0-b01445357d3d",
      "name": "Trevilo enquiry",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.2,
      "position": [
        0,
        0
      ],
      "webhookId": "eefca5fb-bd88-5daa-995b-426d087e404e"
    },
    {
      "parameters": {
        "operation": "removeItemsSeenInPreviousExecutions",
        "dedupeValue": "={{ $('Trevilo enquiry').item.json.headers['idempotency-key'] }}",
        "options": {}
      },
      "id": "49e6c548-8b3e-548f-9dfa-90ae5c4b2b2a",
      "name": "Skip repeat deliveries",
      "type": "n8n-nodes-base.removeDuplicates",
      "typeVersion": 2,
      "position": [
        220,
        0
      ]
    },
    {
      "parameters": {
        "resource": "sms",
        "operation": "send",
        "from": "REPLACE_WITH_YOUR_TWILIO_NUMBER",
        "to": "REPLACE_WITH_ON_CALL_MOBILE",
        "message": "=Urgent enquiry from {{ $('Trevilo enquiry').item.json.body.enquiry?.name || 'someone' }} {{ $('Trevilo enquiry').item.json.body.contact?.phone || $('Trevilo enquiry').item.json.body.contact?.email || '' }}: {{ ($('Trevilo enquiry').item.json.body.enquiry?.message || '').slice(0, 300) }}",
        "options": {}
      },
      "id": "ecfac306-a5ed-5501-961f-36dadc61a843",
      "name": "Text the on-call person",
      "type": "n8n-nodes-base.twilio",
      "typeVersion": 1,
      "position": [
        440,
        0
      ]
    }
  ],
  "connections": {
    "Trevilo enquiry": {
      "main": [
        [
          {
            "node": "Skip repeat deliveries",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Skip repeat deliveries": {
      "main": [
        [
          {
            "node": "Text the on-call person",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": false
  }
}
