{
  "nodes": [
    {
      "id": "e98a66fe-bed4-4b3f-b273-7e0e5f55bf74",
      "name": "Webhook1",
      "type": "n8n-nodes-base.webhook",
      "position": [
        2120,
        -80
      ],
      "parameters": {
        "path": "e373c60f-8530-4368-a486-fcc41f410b6c",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "cd579b01-1cee-4cc7-9014-347703ef9479",
      "name": "Format Marker.io Data1",
      "type": "n8n-nodes-base.code",
      "position": [
        2340,
        -80
      ],
      "parameters": {
        "jsCode": "// Extract data from Marker.io webhook\nconst data = $input.first().json.body.data;\n\n// Format the conversation message\nconst issueTitle = data.title;\nconst issueDescription = data.description;\nconst markerId = data.markerId;\nconst priority = data.priority;\nconst issueType = data.issueType.name;\nconst publicUrl = data.publicUrl;\nconst privateUrl = data.privateUrl;\nconst dueDate = data.dueDate;\nconst browser = `${data.browser.name} ${data.browser.version}`;\nconst os = `${data.operatingSystem.family} ${data.operatingSystem.version}`;\nconst website = data.website.url;\nconst contextString = data.contextString;\n\n// Create formatted message body with Marker.io ticket link\nconst messageBody = `${issueTitle}\n${issueDescription}`;\n\n// Create formatted message body with Marker.io ticket link\nconst noteBody = `\ud83d\udc1b **New Issue Reported via Marker.io**\n\n**Issue:** ${issueTitle}\n**ID:** ${markerId}\n**Type:** ${issueType}\n**Priority:** ${priority}\n**Due Date:** ${dueDate ? new Date(dueDate).toLocaleDateString() : 'Not set'}\n\n**Description:**\n${issueDescription}\n\n**Technical Details:**\n\u2022 Browser: ${browser}\n\u2022 OS: ${os}\n\u2022 Website: ${website}\n\u2022 Context: ${contextString}\n\n**Marker.io Links:**\n\u2022 \ud83d\udd17 [View Issue](${publicUrl})\n\n**Custom Data:**\n${Object.entries(data.customData || {}).map(([key, value]) => `\u2022 ${key}: ${value}`).join('\\n')}`;\n\nreturn [{\n  json: {\n    reporterEmail: data.reporter.email,\n    reporterName: data.reporter.name,\n    messageBody: messageBody,\n    noteBody: noteBody,\n    issueId: data.id,\n    markerId: markerId,\n    priority: priority,\n    issueType: issueType,\n    publicUrl: publicUrl,\n    privateUrl: privateUrl,\n    projectId: data.project.id\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "3eec8d76-a9f6-465f-9580-ea00c77ee4a5",
      "name": "Create/Update Contact1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2560,
        -80
      ],
      "parameters": {
        "url": "https://api.intercom.io/contacts",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "predefinedCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "role",
              "value": "user"
            },
            {
              "name": "email",
              "value": "={{ $json.reporterEmail }}"
            },
            {
              "name": "name",
              "value": "={{ $json.reporterName }}"
            }
          ]
        },
        "nodeCredentialType": "intercomApi"
      },
      "typeVersion": 4.2,
      "continueOnFail": true
    },
    {
      "id": "f8c15e83-a647-449d-bde5-56b0c6688d92",
      "name": "Create Conversation1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2780,
        -80
      ],
      "parameters": {
        "url": "https://api.intercom.io/conversations",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "predefinedCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "from",
              "value": "={{ { \"type\": \"user\", \"email\": $('Format Marker.io Data1').item.json.reporterEmail } }}"
            },
            {
              "name": "body",
              "value": "={{ $('Format Marker.io Data1').item.json.messageBody }}"
            },
            {
              "name": "message_type",
              "value": "inapp"
            }
          ]
        },
        "nodeCredentialType": "intercomApi"
      },
      "credentials": {
        "intercomApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "56ba62f9-fa83-4706-9f81-2cf3fa75aa6c",
      "name": "Add Internal Note1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3000,
        -80
      ],
      "parameters": {
        "url": "=https://api.intercom.io/conversations/{{ $json.conversation_id }}/parts",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "jsonHeaders": "[\n            {\n              \"name\": \"Accept\",\n              \"value\": \"application/json\"\n            },\n            {\n              \"name\": \"Intercom-Version\",\n              \"value\": \"2.13\"\n            }\n          ]",
        "sendHeaders": true,
        "authentication": "predefinedCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "message_type",
              "value": "note"
            },
            {
              "name": "body",
              "value": "={{ $('Format Marker.io Data1').item.json.noteBody }}"
            },
            {
              "name": "admin_id"
            }
          ]
        },
        "specifyHeaders": "json",
        "nodeCredentialType": "intercomApi"
      },
      "credentials": {
        "intercomApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "f959f7b1-8ff7-4ae8-bd98-07e6c4f77524",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1300,
        -720
      ],
      "parameters": {
        "width": 700,
        "height": 2220,
        "content": "# Marker.io to Intercom integration\n\n**Automatically create Intercom conversations with full technical context when your team receive new Marker.io issues**\n\n## \ud83c\udfaf What this template does\n\nThis workflow creates a seamless bridge between Marker.io and Intercom, your customer support platform. Every issue submitted through Marker.io's widget automatically becomes a trackable conversation in Intercom, complete with technical details and visual context. Centralizing customers issues in Intercom helps your support agents continue the conversation right where they work every day.\n\nWhen a bug is reported, the workflow:\n- Creates or updates the reporter as an Intercom contact\n- Opens a new conversation with the reporter and the all issue details\n- Adds a comprehensive internal note with technical metadata\n- Preserves all screenshots, browser info, and custom data\n\n## \u2728 Benefits\n\n- **Zero manual entry** - All bug details transfer automatically\n- **Instant visibility** - Support agents sees issues immediately  \n- **Rich context** - Technical details preserved for developers\n- **Better collaboration** - Single source of truth for bugs\n- **Faster resolution** - No time wasted gathering information\n\n## \ud83d\udca1 Use Cases\n\n- **Product Teams**: Streamline bug triage without switching tools\n- **Support Teams**: Get technical context for customer-reported issues\n- **Development Teams**: Access browser info, console logs and network logs directly from the support tickets\n\n## \ud83d\udd27 How it works\n\n1. **n8n Webhook receives** Marker.io bug report data\n2. **Format and extract** relevant information from the payload\n3. **Create/update contact** in Intercom with reporter details\n4. **Start conversation** with the Title and Bug description\n5. **Add internal note** with full technical context and Marker.io links for the support agent\n\nThe result is a perfectly organized support ticket that your team can act on immediately, with all the context they need to reproduce and resolve the issue.\n\n## \ud83d\udccb Prerequisites\n\n- **Marker.io account** with webhook capabilities\n- **Intercom account** with API access\n- **Intercom Access Token** with appropriate permissions\n- **Admin ID** from your Intercom workspace\n\n## \ud83d\ude80 Setup Instructions\n\n1. **Import this workflow** into your n8n instance\n\n2. **Configure the Webhook**:\n   - Copy the test/production webhook URL after saving\n   - Add to Marker.io: Workspace Settings \u2192 Webhooks \u2192 Create webhook\n   - Select \"Issue Created\" as the trigger event\n\n3. **Set up Intercom credentials**:\n   - Create an Intercom app or use existing API credentials from the Intercom Develper Hub\n   - Add credentials to both HTTP Request nodes\n   - Update the `admin_id` in the \"Add Internal Note\" node with the id of one of your intercom admin\n\n4. **Test the integration**:\n   - Create a test issue in Marker.io\n   - Verify the conversation appears in Intercom\n   - Check that all data transfers correctly\n\n\n## \ud83d\udcca Data Captured\n\n### Customer-facing message includes:\n- Issue title\n- Description\n\n### Internal note includes:\n- \ud83c\udd94 Marker ID\n- \ud83d\udcca Priority level and issue type\n- \ud83d\udcc5 Due date (if set)\n- \ud83d\udda5\ufe0f Browser and OS details\n- \ud83e\udd13 Develper Console & Network logs\n- \ud83c\udf10 Website URL where issue occurred\n- \ud83d\udd17 Direct link to Marker.io issue\n- \ud83d\udcf7\u00a0Screenshot of the issue\n- \ud83d\udce6 Any custom data fields\n\n[\u2192 Read more about our webhook events](https://help.marker.io/en/articles/3738778-webhook-notifications)"
      },
      "typeVersion": 1
    },
    {
      "id": "fc2a3297-bb46-4cdd-ae3c-0d3aab97cfab",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2080,
        460
      ],
      "parameters": {
        "color": 5,
        "width": 440,
        "height": 420,
        "content": "## \ud83d\udea8 Troubleshooting\n\n**Webhook not triggering:**\n- Verify webhook URL is correct in Marker.io\n- Check that \"Issue Created\" event is selected\n- Test with Marker.io's webhook tester\n\n**Contact creation failing:**\n- Ensure Intercom API token has contact write permissions\n- Check email format in reporter data\n\n**Missing internal note:**\n- Verify admin_id is correct (find in Intercom settings)\n- Ensure API token belongs to the admin user\n\n**Data not appearing:**\n- Check webhook payload structure hasn't changed\n- Verify all field paths in the Format node"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Webhook1": {
      "main": [
        [
          {
            "node": "Format Marker.io Data1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Conversation1": {
      "main": [
        [
          {
            "node": "Add Internal Note1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create/Update Contact1": {
      "main": [
        [
          {
            "node": "Create Conversation1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Marker.io Data1": {
      "main": [
        [
          {
            "node": "Create/Update Contact1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}