Skip to content

Instantly share code, notes, and snippets.

@Fbsbreno
Last active June 30, 2025 02:18
Show Gist options
  • Save Fbsbreno/e9b62b9058c6808f740057ce0d5944ec to your computer and use it in GitHub Desktop.
Save Fbsbreno/e9b62b9058c6808f740057ce0d5944ec to your computer and use it in GitHub Desktop.
{
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "scrubscomfort-webhook",
"options": {}
},
"id": "7d8e9a0a-1c5d-4a3b-9874-5e6f8a2d1c3b",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
250,
300
],
"webhookId": "scrubscomfort-atendimento"
},
{
"parameters": {
"authentication": "oAuth2",
"operation": "readData",
"documentId": {
"__rl": true,
"value": "1xXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxX",
"mode": "list",
"cachedResultName": "Estoque de Produtos"
},
"sheetName": {
"__rl": true,
"value": "Estoque",
"mode": "list",
"cachedResultName": "Estoque"
},
"range": "A:G",
"options": {
"valueRenderMode": "FORMATTED_VALUE"
}
},
"id": "9f8e7d6c-5b4a-3c2d-1e0f-9a8b7c6d5e4f",
"name": "Google Sheets - Consultar Estoque",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 3,
"position": [
450,
300
],
"credentials": {
"googleSheetsOAuth2Api": {
"id": "google-sheets-credential",
"name": "Google Sheets account"
}
}
},
{
"parameters": {
"authentication": "oAuth2",
"operation": "append",
"documentId": {
"__rl": true,
"value": "1xXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxX",
"mode": "list",
"cachedResultName": "Clientes e Pedidos"
},
"sheetName": {
"__rl": true,
"value": "Clientes",
"mode": "list",
"cachedResultName": "Clientes"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"mappingMode": "defineBelow",
"value": [
{
"column": "Nome",
"fieldValue": "={{ $json[\"body\"][\"nome\"] }}"
},
{
"column": "Telefone",
"fieldValue": "={{ $json[\"body\"][\"telefone\"] }}"
},
{
"column": "Data",
"fieldValue": "={{ $now.toISOString() }}"
}
]
}
},
"options": {}
},
"id": "3a2b1c0d-9e8f-7g6h-5i4j-3k2l1m0n9o8p",
"name": "Google Sheets - Registrar Cliente",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 3,
"position": [
650,
300
],
"credentials": {
"googleSheetsOAuth2Api": {
"id": "google-sheets-credential",
"name": "Google Sheets account"
}
}
},
{
"parameters": {
"authentication": "oAuth2",
"operation": "append",
"documentId": {
"__rl": true,
"value": "1xXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxX",
"mode": "list",
"cachedResultName": "Pedidos"
},
"sheetName": {
"__rl": true,
"value": "Pedidos",
"mode": "list",
"cachedResultName": "Pedidos"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"mappingMode": "defineBelow",
"value": [
{
"column": "ID Pedido",
"fieldValue": "={{ \"SCF\" + $now.timestamp }}"
},
{
"column": "Nome Cliente",
"fieldValue": "={{ $json[\"body\"][\"nome\"] }}"
},
{
"column": "Telefone",
"fieldValue": "={{ $json[\"body\"][\"telefone\"] }}"
},
{
"column": "Produtos",
"fieldValue": "={{ $json[\"body\"][\"produtos\"] }}"
},
{
"column": "Valor Total",
"fieldValue": "={{ $json[\"body\"][\"valor_total\"] }}"
},
{
"column": "Status",
"fieldValue": "Aguardando Pagamento"
},
{
"column": "Data",
"fieldValue": "={{ $now.toISOString() }}"
}
]
}
},
"options": {}
},
"id": "4p5o6n7m-8l9k-0j1i-2h3g-4f5e6d7c8b9a",
"name": "Google Sheets - Registrar Pedido",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 3,
"position": [
850,
300
],
"credentials": {
"googleSheetsOAuth2Api": {
"id": "google-sheets-credential",
"name": "Google Sheets account"
}
}
},
{
"parameters": {
"authentication": "oAuth2",
"operation": "append",
"documentId": {
"__rl": true,
"value": "1xXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxX",
"mode": "list",
"cachedResultName": "Interesses"
},
"sheetName": {
"__rl": true,
"value": "Interesses",
"mode": "list",
"cachedResultName": "Interesses"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"mappingMode": "defineBelow",
"value": [
{
"column": "Nome",
"fieldValue": "={{ $json[\"body\"][\"nome\"] }}"
},
{
"column": "Telefone",
"fieldValue": "={{ $json[\"body\"][\"telefone\"] }}"
},
{
"column": "Interesse",
"fieldValue": "={{ $json[\"body\"][\"interesse\"] }}"
},
{
"column": "Detalhes",
"fieldValue": "={{ $json[\"body\"][\"detalhes\"] }}"
},
{
"column": "Data",
"fieldValue": "={{ $now.toISOString() }}"
}
]
}
},
"options": {}
},
"id": "0a9b8c7d-6e5f-4g3h-2i1j-0k9l8m7n6o5p",
"name": "Google Sheets - Registrar Interesse",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 3,
"position": [
1050,
300
],
"credentials": {
"googleSheetsOAuth2Api": {
"id": "google-sheets-credential",
"name": "Google Sheets account"
}
}
},
{
"parameters": {
"method": "POST",
"url": "https://api.mercadopago.com/checkout/preferences",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "items",
"value": "={{ $json[\"body\"][\"items\"] }}"
},
{
"name": "back_urls",
"value": "={ \"success\": \"https://scrubscomfort.com/success\", \"failure\": \"https://scrubscomfort.com/failure\", \"pending\": \"https://scrubscomfort.com/pending\" }"
},
{
"name": "auto_return",
"value": "approved"
}
]
},
"options": {}
},
"id": "1q2w3e4r-5t6y-7u8i-9o0p-1a2s3d4f5g6h",
"name": "HTTP Request - Gerar Link Pagamento",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 3,
"position": [
1250,
300
],
"credentials": {
"httpHeaderAuth": {
"id": "mercadopago-credential",
"name": "MercadoPago Auth"
}
}
},
{
"parameters": {
"authentication": "oAuth2",
"operation": "update",
"documentId": {
"__rl": true,
"value": "1xXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxX",
"mode": "list",
"cachedResultName": "Estoque"
},
"sheetName": {
"__rl": true,
"value": "Estoque",
"mode": "list",
"cachedResultName": "Estoque"
},
"range": "={{ \"A\" + $json[\"linhaEstoque\"] + \":G\" + $json[\"linhaEstoque\"] }}",
"options": {
"valueInputMode": "RAW"
},
"valueInputMode": "RAW",
"dataMode": "autoMapInputData"
},
"id": "7h8g9f0e-1d2c-3b4a-5z6x-7c8v9b0n1m2",
"name": "Google Sheets - Atualizar Estoque",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 3,
"position": [
1450,
300
],
"credentials": {
"googleSheetsOAuth2Api": {
"id": "google-sheets-credential",
"name": "Google Sheets account"
}
}
},
{
"parameters": {
"method": "POST",
"url": "https://api.manychat.com/fb/sending/sendContent",
"authentication": "headerAuth",
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Bearer YOUR_MANYCHAT_API_KEY"
}
]
},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "subscriber_id",
"value": "={{ $json[\"body\"][\"subscriber_id\"] }}"
},
{
"name": "data",
"value": "={{ {\"version\": \"v2\", \"content\": {\"messages\": [{\"type\": \"text\", \"text\": $json[\"mensagem\"]}]}} }}"
}
]
},
"options": {}
},
"id": "3q4w5e6r-7t8y-9u0i-1o2p-3a4s5d6f7g8h",
"name": "HTTP Request - Enviar Mensagem ManyChat",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 3,
"position": [
1650,
300
],
"credentials": {
"httpHeaderAuth": {
"id": "manychat-credential",
"name": "ManyChat Auth"
}
}
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json[\"body\"][\"acao\"] }}",
"operation": "equals",
"value2": "consultar_estoque"
}
]
}
},
"id": "9i8u7y6t-5r4e-3w2q-1a2s-3d4f5g6h7j8k",
"name": "IF - Consultar Estoque",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
350,
500
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json[\"body\"][\"acao\"] }}",
"operation": "equals",
"value2": "registrar_cliente"
}
]
}
},
"id": "0l9k8j7h-6g5f-4d3s-2a1p-0o9i8u7y6t5r",
"name": "IF - Registrar Cliente",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
550,
500
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json[\"body\"][\"acao\"] }}",
"operation": "equals",
"value2": "registrar_pedido"
}
]
}
},
"id": "4e3w2q1a-2s3d-4f5g-6h7j-8k9l0z1x2c3v",
"name": "IF - Registrar Pedido",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
750,
500
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json[\"body\"][\"acao\"] }}",
"operation": "equals",
"value2": "registrar_interesse"
}
]
}
},
"id": "5r4e3w2q-1a2s-3d4f-5g6h-7j8k9l0z1x2c",
"name": "IF - Registrar Interesse",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment