Automate Communication Alerts via Twilio and Gmail API

Streamline your communication workflow by automating alerts using the Twilio and Gmail APIs. This integration sends timely notifications directly to your Gmail inbox, ensuring your communication teams stay updated without manual effort. Requires 1 account: Gmail OAuth. Experience faster response times and improved team collaboration, reducing alert processing time by up to 50%.

493 views9 nodesJun 2025Lisa Zhang

Categories

Miscellaneous

APIs

TwilioGmail API

Credentials

1 required

Quick Actions

Copy or download to import into your n8n instance

Workflow JSON
{
  "id": "O4tdYnKCcAztd79t",
  "meta": {
    "instanceId": "5af6b2234d50083634d858a9090654bff0fe3d5b4cb29ef8dd19d1fb64ccdc27",
    "templateCredsSetupCompleted": true
  },
  "name": "Elderwatch",
  "tags": [],
  "nodes": [
    {
      "id": "dbabdb9b-d503-4a9a-8c4b-9edddddfb7c3",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        0,
        0
      ],
      "webhookId": "08b0ca85-beba-4119-906e-77dd3815c38c",
      "parameters": {
        "path": "elderwatch",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "b69a0465-3219-44b2-b5ec-d27354fe41dd",
      "name": "Process & Flag Health",
      "type": "n8n-nodes-base.code",
      "position": [
        220,
        0
      ],
      "parameters": {
        "jsCode": "function safeParse(value, fallback = 0) {\n  const num = parseFloat(value);\n  return isNaN(num) ? fallback : num;\n}\n\nconst heartRate = safeParse($input.first().json.body.heartrate, 0);\nconst bloodOxygen = safeParse($input.first().json.body.bloodoxygen, 0);\nconst walkSymmetry = safeParse($input.first().json.body.walksymmetry, 0);\n\nlet alert = false;\nlet issues = [];\n\nif (heartRate > 100 || heartRate < 50) {\n  alert = true;\n  issues.push(`❤️ Heart rate out of range: ${heartRate.toFixed(0)} bpm`);\n}\nif (bloodOxygen < 92) {\n  alert = true;\n  issues.push(`🩸 Blood oxygen low: ${bloodOxygen.toFixed(0)}%`);\n}\nif (walkSymmetry < 0.9) {\n  alert = true;\n  issues.push(`🚶 Walking symmetry off: ${walkSymmetry}`);\n}\n\nconst summary = `📋 Daily Health Report\n\n❤️ Heart Rate: ${heartRate.toFixed(0)} bpm\n🩸 Blood Oxygen: ${bloodOxygen.toFixed(0)}%\n🚶 Walking Symmetry: ${walkSymmetry >= 0.9 ? \"Good\" : \"Needs Attention\"}\n\n${alert ? `⚠️ Attention Required:\\n${issues.join(\"\\n\")}` : \"✅ All vitals within range.\"}\n`;\n\nreturn [\n  {\n    json: {\n      summary,\n      attentionRequired: alert,\n      issues,\n      heartRate,\n      bloodOxygen,\n      walkSymmetry\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "8fcae627-33fd-424b-b4a2-d460727c6e17",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -40,
        -100
      ],
      "parameters": {
        "color": 4,
        "width": 400,
        "height": 260,
        "content": "## Webhook called from phone.  \nProcessor determines if health scores need immediate attention. "
      },
      "typeVersion": 1
    },
    {
      "id": "f8eee5b3-194b-474c-9e35-5b6b1f8837aa",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        680,
        -260
      ],
      "parameters": {
        "color": 4,
        "width": 540,
        "height": 260,
        "content": "## Twilio HTTP Calls API to make a call and also email."
      },
      "typeVersion": 1
    },
    {
      "id": "9c4ee01d-ca6d-4c0e-8a03-b6aee6233504",
      "name": "Attention Required?",
      "type": "n8n-nodes-base.if",
      "position": [
        420,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "fb74a5b5-d821-4f18-91fe-8f6b8a42cc45",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.attentionRequired }}",
              "rightValue": "=true"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "69e01ada-25e7-4b1b-961f-91053d827ba8",
      "name": "Twilio Call",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        740,
        -180
      ],
      "parameters": {
        "url": "https://api.twilio.com/2010-04-01/Accounts/<accountid>/Calls.json",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "From",
              "value": "+44700000000"
            },
            {
              "name": "To",
              "value": "+44712121211"
            },
            {
              "name": "Url",
              "value": "=https://n8n.domain.com/webhook/twilio-call"
            }
          ]
        },
        "genericAuthType": "httpBasicAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "lead",
              "value": "=+447933713864"
            },
            {
              "name": "summary",
              "value": "={{ $('Process & Flag Health').item.json.summary }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "content-type",
              "value": "application/x-www-form-urlencoded"
            }
          ]
        }
      },
      "credentials": {
        "httpBasicAuth": {
          "id": "n8EpipK2G9ms5zun",
          "name": "Twilio conn"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "eb03f4b3-6d1a-499c-acaa-3705ea87aff0",
      "name": "Warning Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1020,
        -180
      ],
      "webhookId": "8ce8ad81-6f0e-40a8-98aa-c0c2c58e50c3",
      "parameters": {
        "sendTo": "xyz@gmail.com",
        "message": "=<h2>📋 Elder Watch – Daily Health Summary</h2>\n\n<p>Hello,</p>\n\n<p>Here is today’s health update for your loved one:</p>\n\n<hr />\n\n<pre style=\"font-size: 15px; line-height: 1.6em;\">\n{{ $json.summary }}\n</pre>\n\n<hr />\n\n<p>\n{{ $json.attentionRequired === true \n  ? \"⚠️ One or more readings require attention. A phone alert has been triggered.\" \n  : \"✅ All vitals appear within normal range.\" \n}}\n</p>\n\n<p style=\"color: gray; font-size: 12px;\">\nThis report was automatically generated by the Elder Watch system.<br />\nBuilt with love and n8n by a human who has probably not blinked since the first webhook failed.\n</p>\n",
        "options": {},
        "subject": "=⚠️ Alert: Attention Needed – Vitals Out of Range for {{ $now.format('yyyy-MM-dd') }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "igrJbpDgv7Y6QNxA",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "4ed32238-9a7d-4ccb-af71-60d402b817c8",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        700,
        60
      ],
      "parameters": {
        "color": 4,
        "width": 540,
        "height": 260,
        "content": "## Health vitals are ok -email to catetaker."
      },
      "typeVersion": 1
    },
    {
      "id": "2494fdb2-748f-4cf6-a51e-c986ce87f795",
      "name": "All Clear Gmail",
      "type": "n8n-nodes-base.gmail",
      "position": [
        760,
        160
      ],
      "webhookId": "8ce8ad81-6f0e-40a8-98aa-c0c2c58e50c3",
      "parameters": {
        "sendTo": "xyz@gmail.com",
        "message": "=<h2>📋 Elder Watch – Daily Health Summary</h2>\n\n<p>Hello,</p>\n\n<p>Here is today’s health update for your loved one:</p>\n\n<hr />\n\n<pre style=\"font-size: 15px; line-height: 1.6em;\">\n{{ $json.summary }}\n</pre>\n\n<hr />\n\n<p>\n{{ $json.attentionRequired === true \n  ? \"⚠️ One or more readings require attention. A phone alert has been triggered.\" \n  : \"✅ All vitals appear within normal range.\" \n}}\n</p>\n\n<p style=\"color: gray; font-size: 12px;\">\nThis report was automatically generated by the Elder Watch system.<br />\nBuilt with love and n8n by a human who has probably not blinked since the first webhook failed.\n</p>\n",
        "options": {},
        "subject": "=✅ All Clear: Health Summary for {{ $now.format('yyyy-MM-dd') }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "6546456",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    }
  ],
  "active": true,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "9c0a882c-27bc-4263-9fa0-11f6343957a9",
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Process & Flag Health",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Twilio Call": {
      "main": [
        [
          {
            "node": "Warning Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Attention Required?": {
      "main": [
        [
          {
            "node": "Twilio Call",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "All Clear Gmail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process & Flag Health": {
      "main": [
        [
          {
            "node": "Attention Required?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Related Workflows

Automate Data Capture with Webhooks and HTTP Requests

Streamline your data collection process using webhooks to capture real-time data, set specific parameters, and send HTTP requests for automated processing. Ideal for AI-powered automation users. Requires 0 accounts. Save hours on manual data entry and effortlessly manage 100+ data points daily with this efficient workflow.

41,809 views
Miscellaneous

Sync Telegram Messages with OpenAI GPT for Instant Responses

Automate message handling using the Telegram Bot API and enrich responses with OpenAI GPT for intelligent conversations. This workflow is perfect for AI-powered automation users looking to streamline their communication. Requires 2 accounts: Telegram Bot Token and OpenAI API Key. Save hours on customer interactions and enhance user engagement with instant, AI-generated replies.

23,896 views
MiscellaneousAI Summarization

Automate Data Processing with n8n's Set and Split Out Tools

Streamline your data workflows using n8n's Set and Split Out tools to efficiently manage and transform data. This workflow is ideal for business teams looking to automate repetitive tasks. Requires 0 accounts: simply set up your n8n instance. Experience enhanced productivity by reducing manual data handling, saving your team hours each week.

22,625 views
Miscellaneous

Automate User Logins with Auth0 Using n8n Workflow

Streamline user authentication by automating login processes with Auth0 via n8n. This workflow leverages HTTP requests, conditional logic, and error handling to create a seamless user experience. Perfect for developers and integrators. Requires 0 accounts. Save hours on manual login management and enhance security while providing instant access to users.

14,866 views
Miscellaneous

How to Use This Workflow

1Import to n8n

  1. Copy the JSON using the button above
  2. Open your n8n instance
  3. Click “Import workflow” or press Ctrl+V
  4. Paste the JSON and click “Import”

2Before Running

Configure credentials and update service-specific settings before executing the workflow. Review required credentials in the Technical Details section above.

493