{
  "id": "lFocIkQMljDaZxLO",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Partnerstack notifications",
  "tags": [],
  "nodes": [
    {
      "id": "dfb1df25-fe32-490c-82bc-237d0a888797",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        0,
        0
      ],
      "parameters": {
        "path": "32a160b4-df74-447a-ab12-c98abe411862",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "19c189b6-c7ed-402f-9b93-1f1a35259888",
      "name": "Append Row in Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        220,
        0
      ],
      "parameters": {
        "columns": {
          "value": {
            "date": "={{ new Date($json.body.data.created_at).toISOString().split('T')[0] }}",
            "tool": "={{ $json.body.data.company.name }}",
            "email": "={{ $json.body.data.customer_email }}",
            "eventName": "={{ $json.body.event }}",
            "customerName": "={{ $json.body.data.customer_name }}"
          },
          "schema": [
            {
              "id": "date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "eventName",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "eventName",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "tool",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "tool",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "customerName",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "customerName",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1HOI6sdJ4mzclXy1gE5X1nhoxpjXfnVDhj2ka60SP28g/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1HOI6sdJ4mzclXy1gE5X1nhoxpjXfnVDhj2ka60SP28g",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1HOI6sdJ4mzclXy1gE5X1nhoxpjXfnVDhj2ka60SP28g/edit?usp=drivesdk",
          "cachedResultName": "Partnerstack affiliate activity"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "c58f295c-3827-4515-8c71-809e07ef0e15",
      "name": "Send Notification",
      "type": "n8n-nodes-base.telegram",
      "position": [
        660,
        0
      ],
      "parameters": {
        "text": "=New Partnerstack event\n\nEvent: {{ $('Webhook').item.json.body.event }}\nTool: {{ $('Webhook').item.json.body.data.company.name }}\nCustomer: {{ $('Webhook').item.json.body.data.customer_name }}\nEmail: {{ $('Webhook').item.json.body.data.customer_email }}",
        "chatId": "={{ $json.chatId }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "1326d545-200e-47fd-a586-5c4377384db9",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -380,
        -80
      ],
      "parameters": {
        "width": 320,
        "height": 280,
        "content": "## Set up instructions \n- Go into Partnerstack > My account >  Postbacks > Create a postback\n- Paste your n8n webhook URL\n- Give it a name and select the events you want to track\n- Create the postback inside Patnerstack \n- Make sure your n8n workflow is listening for an event to grab the data received from a test event.\n- Send a test event from Partnerstack to n8n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "8f167af4-93ea-405e-ba40-bb69df62d04e",
      "name": "Set Chat Id",
      "type": "n8n-nodes-base.set",
      "position": [
        440,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "9e585adf-f859-4743-81d1-c2a926562418",
              "name": "chatId",
              "type": "string",
              "value": "setyourTelgramChatIdHere"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "aab27664-d925-49ad-93ed-20adbc0c8b69",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        380,
        -180
      ],
      "parameters": {
        "width": 220,
        "height": 340,
        "content": "## Set chat ID \nInsert your Telegram chat id to get notified in a private channel with your team members"
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "settings": {
    "timezone": "Europe/Madrid",
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": "qFOYM3IA9QZ7fMym",
    "executionOrder": "v1"
  },
  "versionId": "9d05edb1-dd83-4263-afdd-15f336c20cd4",
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Append Row in Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Chat Id": {
      "main": [
        [
          {
            "node": "Send Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append Row in Sheets": {
      "main": [
        [
          {
            "node": "Set Chat Id",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}