Created
February 16, 2026 03:43
-
-
Save JulioBorges/2051e7c205cf12231aac0f6c5a1dba4e to your computer and use it in GitHub Desktop.
n8n-shopee-affiliate-links.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "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", | |
| "webhookId": "db98cfec-e8c7-421c-b65c-9793553a3c44" | |
| }, | |
| { | |
| "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ção", | |
| "message": "Houve um erro na execução da geração 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", | |
| "webhookId": "06af2282-4f67-495a-bbb4-26fa3fb225bb", | |
| "credentials": { | |
| "gmailOAuth2": { | |
| "id": "K7KDV3loUZ0yCamo", | |
| "name": "borges.juliocezar@gmail.com" | |
| } | |
| } | |
| }, | |
| { | |
| "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ÇÃO BÁSICA\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 é 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 | |
| } | |
| ] | |
| ] | |
| } | |
| }, | |
| "pinData": { | |
| "Webhook": [ | |
| { | |
| "headers": { | |
| "host": "n8n.cool.calenbarber.app", | |
| "user-agent": "PostmanRuntime/7.51.1", | |
| "content-length": "121", | |
| "accept": "*/*", | |
| "accept-encoding": "gzip, deflate, br", | |
| "cache-control": "no-cache", | |
| "content-type": "application/json", | |
| "postman-token": "f2c90a56-1cd0-41b9-a5ec-4d0402489fa6", | |
| "x-forwarded-for": "201.17.148.56", | |
| "x-forwarded-host": "n8n.cool.calenbarber.app", | |
| "x-forwarded-port": "443", | |
| "x-forwarded-proto": "https", | |
| "x-forwarded-server": "99f470217cf6", | |
| "x-real-ip": "201.17.148.56" | |
| }, | |
| "params": {}, | |
| "query": {}, | |
| "body": { | |
| "url": "https://shopee.com.br/T%C3%AAnis-Casual-Masculino-Leve-Sapat%C3%AAnis-Sola-Preta-i.785541033.23720954312" | |
| }, | |
| "webhookUrl": "https://n8n.cool.calenbarber.app/webhook-test/afiliados-shopee", | |
| "executionMode": "test" | |
| } | |
| ] | |
| }, | |
| "meta": { | |
| "templateCredsSetupCompleted": true, | |
| "instanceId": "4e474214bcf60c1518d0b243ca48faad8775bf534b0cde8f194334c4a5c35e19" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment