{
  "id": "nn9CW8uoGGYePKzj",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Reply.io notifications - for publish",
  "tags": [],
  "nodes": [
    {
      "id": "11d1dd70-8599-45ce-933e-09dcaa9a38cb",
      "name": "Get subscriptions",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -32,
        0
      ],
      "parameters": {
        "url": "https://api.reply.io/api/v2/webhooks",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        },
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "47bf6c91-9cab-49f6-8296-63c280f9d96c",
      "name": "Create subscription (email)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -32,
        -448
      ],
      "parameters": {
        "url": "https://api.reply.io/api/v2/webhooks",
        "method": "POST",
        "options": {},
        "jsonBody": "{\n  \"event\": \"email_replied\",\n    \"url\": \"<Your webhook URL here>\",\n    \"payload\": {\n        \"includeEmailUrl\": true,\n        \"includeProspectCustomFields\": true\n    }\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        },
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "467aa806-f292-4e1d-a64e-f70e5d993f59",
      "name": "Create subscription (linkedin)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -32,
        -224
      ],
      "parameters": {
        "url": "https://api.reply.io/api/v2/webhooks",
        "method": "POST",
        "options": {},
        "jsonBody": "{\n  \"event\": \"linkedin_message_replied\",\n    \"url\": \"<Your webhook URL here>\",\n    \"payload\": {\n        \"includeEmailUrl\": true,\n        \"includeProspectCustomFields\": true\n    }\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        },
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "b05c1c7d-16a4-482b-9c16-26be2c9468bb",
      "name": "Get person info from Reply.io",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        192,
        224
      ],
      "parameters": {
        "url": "=https://api.reply.io/v1/people?id={{ $json.body.contact_id }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "ca03e619-d993-4a3f-808f-12475081b068",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        208,
        -464
      ],
      "parameters": {
        "width": 224,
        "height": 608,
        "content": "## Utility nodes\n\nIn order to start receiveing webhook requests from Reply.io we need to create subscriptions.\nTo do so:\n1. Open \"Create subscribtion (email)\" and \"Create subscribtion (linkedin)\" nodes\n2. Add your Reply.io API key as Header auth\n3. Place your webhook URL in \"url\" body field\n4. Trigger those nodes manually to create subscriptions.\n\nYou can also use \"Get subscriptions\" node to check your active subscriptions."
      },
      "typeVersion": 1
    },
    {
      "id": "e2f230c5-3d20-46e5-8fe0-d0ddafa979f0",
      "name": "Update from Reply.io",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -32,
        224
      ],
      "parameters": {
        "path": "ef5fab65-c7f3-4740-94b2-e2c6c4fb8cc4",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "eee92c98-ebbe-40cb-a85b-f1ec2428fb97",
      "name": "Send notification to Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        416,
        224
      ],
      "parameters": {
        "text": "=New message from outreach!\n\nType: {{ $('Update from Reply.io').item.json.body.event.type }}\n\nContact: {{ $json.firstName }} {{ $json.lastName }}\nEmail: {{ $json.email }}\nLinkedIn: {{ $json.linkedInProfile }}\n\nSequence: {{ $('Update from Reply.io').item.json.body.sequence_fields.name }}\n\nCheck inbox: https://run.reply.io/Dashboard/Material#/inbox",
        "chatId": "<Your chat ID here>",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "617fc811-de4e-40a2-9daa-911f17c0e3e9",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -128,
        -496
      ],
      "parameters": {
        "color": 7,
        "width": 608,
        "height": 672,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "048440d9-1d87-4a54-a228-dbc1aacd7955",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -128,
        192
      ],
      "parameters": {
        "color": 7,
        "width": 752,
        "height": 224,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "83c2567a-e415-4e00-9f84-bae2e17343a5",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -128,
        432
      ],
      "parameters": {
        "width": 752,
        "height": 320,
        "content": "## Notifications processing\n\nHere we receive request from Reply.io, get person info using Reply API and send formatted notification to Telegram chat.\n\nSetup steps:\n1. Add your Reply.io API key as Header auth in \"Get person info from Reply.io\" node\n2. Add your Telegram credentials and input your Chat ID in \"Send notification to Telegram\" node.\n\np.s. If you want this bot to send notification to Telegram group - don't forget to add this bot to the group first :)"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "595c86c1-005c-41ad-9c2b-2ff1f2e71069",
  "connections": {
    "Update from Reply.io": {
      "main": [
        [
          {
            "node": "Get person info from Reply.io",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get person info from Reply.io": {
      "main": [
        [
          {
            "node": "Send notification to Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}