AutomationFlowsEmail & Gmail › N8n Shopee Affiliate Links

N8n Shopee Affiliate Links

N8N-Shopee-Affiliate-Links. Uses gmail, httpRequest, crypto. Webhook trigger; 8 nodes.

Webhook trigger★★★★☆ complexity8 nodesGmailHTTP RequestCrypto
Email & Gmail Trigger: Webhook Nodes: 8 Complexity: ★★★★☆ Added:

This workflow follows the Gmail → HTTP Request recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "afiliados-shopee",
        "responseMode": "responseNode",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        -304,
        -16
      ],
      "id": "852f9cbc-5449-42a0-9b05-c44dd5cd4824",
      "name": "Webhook"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.5,
      "position": [
        816,
        -112
      ],
      "id": "264b3503-5470-4550-8c07-a30281de8615",
      "name": "Respond to Webhook"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "570007f6-01ff-4705-97a9-f72da9b21756",
              "leftValue": "={{ $json.status }}",
              "rightValue": 200,
              "operator": {
                "type": "number",
                "operation": "notEquals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        816,
        80
      ],
      "id": "e0f9c7e5-2c0e-4a26-8e8c-61f862be15bf",
      "name": "If"
    },
    {
      "parameters": {
        "sendTo": "teste@test.com",
        "subject": "Erro na execu\u00e7\u00e3o",
        "message": "Houve um erro na execu\u00e7\u00e3o da gera\u00e7\u00e3o do link de afiliados",
        "options": {}
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        1040,
        80
      ],
      "id": "a3379021-73bc-4cea-baa1-e61ccf1b656c",
      "name": "Send a message",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://open-api.affiliate.shopee.com.br/graphql",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "=SHA256 Credential={{ $('Preparar Request Shopee').item.json.appId }},Timestamp={{ $('Preparar Request Shopee').item.json.timestamp }},Signature={{ $json.signature }}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ $json.rawBody }}",
        "options": {
          "allowUnauthorizedCerts": false
        }
      },
      "id": "7a5a46d2-be0a-4ee9-acf0-68bc0f8b8e29",
      "name": "Gerar Link Afiliado",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        592,
        -16
      ]
    },
    {
      "parameters": {
        "jsCode": "// CONFIGURA\u00c7\u00c3O B\u00c1SICA\nconst appId = $input.first().json.shopee_app_id;\nconst appSecret = $input.first().json.shopee_app_secret;\nconst timestamp = $input.first().json.timestamp;\nconst linkOriginal = $input.first().json.url;\n\n// Usar mutation GraphQL com input conforme schema da API\n// subIds \u00e9 opcional e pode ser omitido ou passar array vazio\nconst graphqlQuery = `mutation {\n    generateShortLink(input: { originUrl: \"${linkOriginal}\" }) {\n        shortLink\n    }\n}`;\n\nconst payload = {\n    query: graphqlQuery\n};\n\nconst payloadString = JSON.stringify(payload);\n\nreturn {\n  appId,\n  appSecret,\n  timestamp,\n  body: payload,\n  rawBody: payloadString\n};"
      },
      "id": "d0f24385-27c9-4d76-9d98-c01e0c1cb64c",
      "name": "Preparar Request Shopee",
      "type": "n8n-nodes-base.code",
      "typeVersion": 1,
      "position": [
        144,
        -16
      ]
    },
    {
      "parameters": {
        "type": "SHA256",
        "value": "={{ $json.appId + $json.timestamp + $json.rawBody + $('variaveis').item.json.shopee_app_secret }}",
        "dataPropertyName": "signature"
      },
      "type": "n8n-nodes-base.crypto",
      "typeVersion": 1,
      "position": [
        368,
        -16
      ],
      "id": "e5cd6614-9a96-4e31-86cb-d28698eb69c7",
      "name": "Crypto"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "a1ff29c8-d405-4655-9860-b8913dab4e98",
              "name": "url",
              "value": "={{ $('Webhook').item.json.body.url }}",
              "type": "string"
            },
            {
              "id": "0586320b-74f6-4605-97f9-54a539ae62e3",
              "name": "timestamp",
              "value": "={{ $now.toFormat('X') }}",
              "type": "string"
            },
            {
              "id": "8dd164a0-4e92-4028-a207-a1dbfa87b362",
              "name": "shopee_app_id",
              "value": "18332030606",
              "type": "string"
            },
            {
              "id": "748fb8bf-c7b7-4f24-8da9-36a6c3c1c1ff",
              "name": "shopee_app_secret",
              "value": "MJS67QHU7HMCRX5AHI75YI2FO4M2AIXP",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -80,
        -16
      ],
      "id": "84cda82b-16ad-48e8-af0e-dcd781b63759",
      "name": "variaveis"
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "variaveis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gerar Link Afiliado": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          },
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Preparar Request Shopee": {
      "main": [
        [
          {
            "node": "Crypto",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Crypto": {
      "main": [
        [
          {
            "node": "Gerar Link Afiliado",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "variaveis": {
      "main": [
        [
          {
            "node": "Preparar Request Shopee",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "meta": {
    "templateCredsSetupCompleted": true
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

N8N-Shopee-Affiliate-Links. Uses gmail, httpRequest, crypto. Webhook trigger; 8 nodes.

Source: https://gist.github.com/JulioBorges/2051e7c205cf12231aac0f6c5a1dba4e — original creator credit. Request a take-down →

More Email & Gmail workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Email & Gmail

This workflow automates a document approval process using Supabase and Gmail. Teams that need structured multi-level document approvals. Companies managing policies, contracts, or proposals. Medical d

Supabase, Crypto, Gmail +3
Email & Gmail

Automate WhatsApp communication for recruitment agencies with an interactive, structured customer experience. This workflow handles pricing inquiries, request submissions, tracking, complaints, and hu

HTTP Request, Google Sheets, Gmail +1
Email & Gmail

This template turns Podium's conversation inbox into a full sales CRM with a custom funnel, AI message classification, automated drip follow-ups, daily admin reports, and a live Kanban dashboard. Six

HTTP Request, Google Sheets, Gmail
Email & Gmail

Suspicious_login_detection. Uses postgres, httpRequest, noOp, html. Webhook trigger; 43 nodes.

Postgres, HTTP Request, Gmail +1
Email & Gmail

This n8n workflow is designed for security monitoring and incident response when suspicious login events are detected. It can be initiated either manually from within the n8n UI for testing or automat

Postgres, HTTP Request, Gmail +1