{
  "id": "yDUWltdKzcyL7PJD",
  "meta": {
    "instanceId": "29dccb3f636e984cab758d231ae358f0228fd43880fb6292144b674668680e5a",
    "templateCredsSetupCompleted": true
  },
  "name": "Tawk.to Chat to Gmail Alert Automation in n8n",
  "tags": [],
  "nodes": [
    {
      "id": "ae1e6f64-3e83-4aaf-bf4b-a10df03f270c",
      "name": "Receive Tawk.to Request",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -620,
        -360
      ],
      "webhookId": "a4bf95cd-a30a-4ae0-bd2a-6d96e6cca3b4",
      "parameters": {
        "path": "a4bf95cd-a30a-4ae0-bd2a-6d96e6cca3b4",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "f342fac4-9c57-4717-8e92-f37664aabc4c",
      "name": "Format the message",
      "type": "n8n-nodes-base.set",
      "position": [
        -400,
        -360
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "1562e142-b34a-4823-afec-a3073c88d348",
              "name": "chat_id",
              "type": "string",
              "value": "={{ $json.body.chatId }}"
            },
            {
              "id": "38edc953-5924-4a1b-821a-7146cea02c6e",
              "name": "visitor_country",
              "type": "string",
              "value": "={{ $json.body.visitor.country }}"
            },
            {
              "id": "a7aae533-a46e-40ac-9dda-19d79314580a",
              "name": "visitor_name",
              "type": "string",
              "value": "={{ $json.body.visitor.name }}"
            },
            {
              "id": "917b2c1b-711b-4349-adc3-869d3330177a",
              "name": "message",
              "type": "string",
              "value": "={{ $json.body.message.text }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "32cd7e5e-c374-4725-95bc-9cdad748d38a",
      "name": "Send alert email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -180,
        -360
      ],
      "webhookId": "541842a3-7016-4745-b243-98ec2dad8ae2",
      "parameters": {
        "sendTo": "",
        "message": "=Hi Team,\n\nYou have received a new chat message.\n\nChat ID: {{$json.chat_id}}\nVisitor Name: {{$json.visitor_name}}\nVisitor Country: {{$json.visitor_country}}\n\nMessage:\n{{$json.message}}\n\nPlease respond promptly.\n\nBest regards,\nYour Support Bot\n",
        "options": {},
        "subject": "=Support Alert: New Chat from {{ $json.visitor_name }} ({{ $json.visitor_country }})",
        "emailType": "text"
      },
      "typeVersion": 2.1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "a8802e9e-e31d-4179-9d73-cd629f9dfb6e",
  "connections": {
    "Send alert email": {
      "main": [
        []
      ]
    },
    "Format the message": {
      "main": [
        [
          {
            "node": "Send alert email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Receive Tawk.to Request": {
      "main": [
        [
          {
            "node": "Format the message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}