Skip to main content
Glama

Uazapi WhatsApp MCP Server

by pabloweyne
workflow-chatbot-uazapi.json17.3 kB
{ "name": "UAZAPI WhatsApp Chatbot", "nodes": [ { "parameters": { "httpMethod": "POST", "path": "uazapi-webhook", "responseMode": "responseNode", "options": {} }, "id": "webhook-trigger", "name": "Webhook UAZAPI", "type": "n8n-nodes-base.webhook", "typeVersion": 2, "position": [240, 300] }, { "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict" }, "conditions": [ { "id": "phone-check", "leftValue": "={{ $json.body.phone }}", "rightValue": "SEU_NUMERO_AQUI", "operator": { "type": "string", "operation": "equals" } } ], "combinator": "and" }, "options": {} }, "id": "filter-authorized", "name": "Verificar Numero Autorizado", "type": "n8n-nodes-base.if", "typeVersion": 2, "position": [460, 300] }, { "parameters": { "assignments": { "assignments": [ { "id": "user-message", "name": "userMessage", "value": "={{ $json.body.message.conversation || $json.body.message.extendedTextMessage?.text || '' }}", "type": "string" }, { "id": "phone", "name": "phone", "value": "={{ $json.body.phone }}", "type": "string" }, { "id": "message-id", "name": "messageId", "value": "={{ $json.body.key.id }}", "type": "string" } ] }, "options": {} }, "id": "extract-data", "name": "Extrair Dados da Mensagem", "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [680, 240] }, { "parameters": { "model": "gpt-4o", "messages": { "values": [ { "role": "system", "content": "Você é um assistente de gerenciamento do WhatsApp via UAZAPI. Você pode executar as seguintes ações:\n\n## AÇÕES DISPONÍVEIS\n\n### Mensagens\n- enviar_texto: Enviar mensagem de texto para um número\n- enviar_imagem: Enviar imagem com URL\n- enviar_documento: Enviar documento/arquivo\n- enviar_audio: Enviar áudio\n- enviar_video: Enviar vídeo\n\n### Grupos\n- criar_grupo: Criar novo grupo com participantes\n- adicionar_participante: Adicionar pessoa a um grupo\n- remover_participante: Remover pessoa de um grupo\n- listar_grupos: Listar todos os grupos\n- info_grupo: Obter informações de um grupo\n\n### Contatos\n- listar_contatos: Listar contatos salvos\n- verificar_numero: Verificar se número tem WhatsApp\n\n### Links\n- enviar_link: Enviar link com preview\n- link_grupo: Obter link de convite do grupo\n\n## FORMATO DE RESPOSTA\n\nSempre responda em JSON com:\n{\n \"acao\": \"nome_da_acao\",\n \"parametros\": { ... },\n \"mensagem_usuario\": \"Resposta amigável para o usuário\"\n}\n\nSe não entender o pedido ou precisar de mais informações:\n{\n \"acao\": \"perguntar\",\n \"parametros\": {},\n \"mensagem_usuario\": \"Sua pergunta aqui\"\n}\n\n## REGRAS\n- Números devem incluir código do país (ex: 5511999999999)\n- Seja sempre educado e confirme ações importantes\n- Se o usuário pedir algo que não pode fazer, explique\n- Para grupos, pode usar nome ou ID do grupo" }, { "role": "user", "content": "={{ $json.userMessage }}" } ] }, "options": { "temperature": 0.3, "maxTokens": 1000 } }, "id": "openai-process", "name": "OpenAI Processar Comando", "type": "@n8n/n8n-nodes-langchain.openAi", "typeVersion": 1.6, "position": [900, 240], "credentials": { "openAiApi": { "id": "OPENAI_CREDENTIAL_ID", "name": "OpenAI API" } } }, { "parameters": { "jsCode": "// Parse da resposta do GPT\nconst gptResponse = $input.first().json.message.content;\nlet parsed;\n\ntry {\n // Tentar extrair JSON da resposta\n const jsonMatch = gptResponse.match(/\\{[\\s\\S]*\\}/);\n if (jsonMatch) {\n parsed = JSON.parse(jsonMatch[0]);\n } else {\n parsed = {\n acao: 'responder',\n parametros: {},\n mensagem_usuario: gptResponse\n };\n }\n} catch (e) {\n parsed = {\n acao: 'responder',\n parametros: {},\n mensagem_usuario: gptResponse\n };\n}\n\nreturn {\n json: {\n ...parsed,\n phone: $('Extrair Dados da Mensagem').first().json.phone\n }\n};" }, "id": "parse-response", "name": "Parse Resposta GPT", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [1120, 240] }, { "parameters": { "rules": { "values": [ { "conditions": { "options": { "caseSensitive": false }, "conditions": [{ "leftValue": "={{ $json.acao }}", "rightValue": "enviar_texto", "operator": { "type": "string", "operation": "equals" } }] }, "renameOutput": true, "outputLabel": "Enviar Texto" }, { "conditions": { "options": { "caseSensitive": false }, "conditions": [{ "leftValue": "={{ $json.acao }}", "rightValue": "enviar_imagem", "operator": { "type": "string", "operation": "equals" } }] }, "renameOutput": true, "outputLabel": "Enviar Imagem" }, { "conditions": { "options": { "caseSensitive": false }, "conditions": [{ "leftValue": "={{ $json.acao }}", "rightValue": "criar_grupo", "operator": { "type": "string", "operation": "equals" } }] }, "renameOutput": true, "outputLabel": "Criar Grupo" }, { "conditions": { "options": { "caseSensitive": false }, "conditions": [{ "leftValue": "={{ $json.acao }}", "rightValue": "adicionar_participante", "operator": { "type": "string", "operation": "equals" } }] }, "renameOutput": true, "outputLabel": "Add Participante" }, { "conditions": { "options": { "caseSensitive": false }, "conditions": [{ "leftValue": "={{ $json.acao }}", "rightValue": "remover_participante", "operator": { "type": "string", "operation": "equals" } }] }, "renameOutput": true, "outputLabel": "Remove Participante" }, { "conditions": { "options": { "caseSensitive": false }, "conditions": [{ "leftValue": "={{ $json.acao }}", "rightValue": "listar_grupos", "operator": { "type": "string", "operation": "equals" } }] }, "renameOutput": true, "outputLabel": "Listar Grupos" }, { "conditions": { "options": { "caseSensitive": false }, "conditions": [{ "leftValue": "={{ $json.acao }}", "rightValue": "listar_contatos", "operator": { "type": "string", "operation": "equals" } }] }, "renameOutput": true, "outputLabel": "Listar Contatos" } ], "fallbackOutput": { "renameOutput": true, "outputLabel": "Resposta Simples" } }, "options": {} }, "id": "router-action", "name": "Router de Ações", "type": "n8n-nodes-base.switch", "typeVersion": 3.2, "position": [1340, 240] }, { "parameters": { "method": "POST", "url": "=https://api.uazapi.com/instances/{{ $env.UAZAPI_INSTANCE_ID }}/messages/send/text", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendBody": true, "specifyBody": "json", "jsonBody": "={\n \"phone\": \"{{ $json.parametros.numero }}\",\n \"message\": \"{{ $json.parametros.mensagem }}\"\n}", "options": {} }, "id": "uazapi-send-text", "name": "UAZAPI Enviar Texto", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [1600, 0], "credentials": { "httpHeaderAuth": { "id": "UAZAPI_CREDENTIAL_ID", "name": "UAZAPI Auth" } } }, { "parameters": { "method": "POST", "url": "=https://api.uazapi.com/instances/{{ $env.UAZAPI_INSTANCE_ID }}/messages/send/image", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendBody": true, "specifyBody": "json", "jsonBody": "={\n \"phone\": \"{{ $json.parametros.numero }}\",\n \"mediaUrl\": \"{{ $json.parametros.url }}\",\n \"caption\": \"{{ $json.parametros.legenda || '' }}\"\n}", "options": {} }, "id": "uazapi-send-image", "name": "UAZAPI Enviar Imagem", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [1600, 120], "credentials": { "httpHeaderAuth": { "id": "UAZAPI_CREDENTIAL_ID", "name": "UAZAPI Auth" } } }, { "parameters": { "method": "POST", "url": "=https://api.uazapi.com/instances/{{ $env.UAZAPI_INSTANCE_ID }}/groups/create", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendBody": true, "specifyBody": "json", "jsonBody": "={\n \"name\": \"{{ $json.parametros.nome }}\",\n \"participants\": {{ JSON.stringify($json.parametros.participantes || []) }}\n}", "options": {} }, "id": "uazapi-create-group", "name": "UAZAPI Criar Grupo", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [1600, 240], "credentials": { "httpHeaderAuth": { "id": "UAZAPI_CREDENTIAL_ID", "name": "UAZAPI Auth" } } }, { "parameters": { "method": "POST", "url": "=https://api.uazapi.com/instances/{{ $env.UAZAPI_INSTANCE_ID }}/groups/{{ $json.parametros.grupo_id }}/participants/add", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendBody": true, "specifyBody": "json", "jsonBody": "={\n \"participants\": {{ JSON.stringify($json.parametros.numeros || [$json.parametros.numero]) }}\n}", "options": {} }, "id": "uazapi-add-participant", "name": "UAZAPI Add Participante", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [1600, 360], "credentials": { "httpHeaderAuth": { "id": "UAZAPI_CREDENTIAL_ID", "name": "UAZAPI Auth" } } }, { "parameters": { "method": "DELETE", "url": "=https://api.uazapi.com/instances/{{ $env.UAZAPI_INSTANCE_ID }}/groups/{{ $json.parametros.grupo_id }}/participants/remove", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendBody": true, "specifyBody": "json", "jsonBody": "={\n \"participants\": {{ JSON.stringify($json.parametros.numeros || [$json.parametros.numero]) }}\n}", "options": {} }, "id": "uazapi-remove-participant", "name": "UAZAPI Remove Participante", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [1600, 480], "credentials": { "httpHeaderAuth": { "id": "UAZAPI_CREDENTIAL_ID", "name": "UAZAPI Auth" } } }, { "parameters": { "method": "GET", "url": "=https://api.uazapi.com/instances/{{ $env.UAZAPI_INSTANCE_ID }}/groups", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "options": {} }, "id": "uazapi-list-groups", "name": "UAZAPI Listar Grupos", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [1600, 600], "credentials": { "httpHeaderAuth": { "id": "UAZAPI_CREDENTIAL_ID", "name": "UAZAPI Auth" } } }, { "parameters": { "method": "GET", "url": "=https://api.uazapi.com/instances/{{ $env.UAZAPI_INSTANCE_ID }}/contacts", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "options": {} }, "id": "uazapi-list-contacts", "name": "UAZAPI Listar Contatos", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [1600, 720], "credentials": { "httpHeaderAuth": { "id": "UAZAPI_CREDENTIAL_ID", "name": "UAZAPI Auth" } } }, { "parameters": { "method": "POST", "url": "=https://api.uazapi.com/instances/{{ $env.UAZAPI_INSTANCE_ID }}/messages/send/text", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendBody": true, "specifyBody": "json", "jsonBody": "={\n \"phone\": \"{{ $('Extrair Dados da Mensagem').first().json.phone }}\",\n \"message\": \"{{ $json.mensagem_usuario }}\"\n}", "options": {} }, "id": "send-response-to-user", "name": "Enviar Resposta ao Usuario", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [1900, 400], "credentials": { "httpHeaderAuth": { "id": "UAZAPI_CREDENTIAL_ID", "name": "UAZAPI Auth" } } }, { "parameters": { "respondWith": "json", "responseBody": "={\"status\": \"ok\"}", "options": {} }, "id": "respond-webhook", "name": "Responder Webhook", "type": "n8n-nodes-base.respondToWebhook", "typeVersion": 1.1, "position": [2120, 400] }, { "parameters": { "respondWith": "json", "responseBody": "={\"status\": \"unauthorized\"}", "options": { "responseCode": 403 } }, "id": "respond-unauthorized", "name": "Responder Nao Autorizado", "type": "n8n-nodes-base.respondToWebhook", "typeVersion": 1.1, "position": [680, 400] } ], "connections": { "Webhook UAZAPI": { "main": [[{ "node": "Verificar Numero Autorizado", "type": "main", "index": 0 }]] }, "Verificar Numero Autorizado": { "main": [ [{ "node": "Extrair Dados da Mensagem", "type": "main", "index": 0 }], [{ "node": "Responder Nao Autorizado", "type": "main", "index": 0 }] ] }, "Extrair Dados da Mensagem": { "main": [[{ "node": "OpenAI Processar Comando", "type": "main", "index": 0 }]] }, "OpenAI Processar Comando": { "main": [[{ "node": "Parse Resposta GPT", "type": "main", "index": 0 }]] }, "Parse Resposta GPT": { "main": [[{ "node": "Router de Ações", "type": "main", "index": 0 }]] }, "Router de Ações": { "main": [ [{ "node": "UAZAPI Enviar Texto", "type": "main", "index": 0 }], [{ "node": "UAZAPI Enviar Imagem", "type": "main", "index": 0 }], [{ "node": "UAZAPI Criar Grupo", "type": "main", "index": 0 }], [{ "node": "UAZAPI Add Participante", "type": "main", "index": 0 }], [{ "node": "UAZAPI Remove Participante", "type": "main", "index": 0 }], [{ "node": "UAZAPI Listar Grupos", "type": "main", "index": 0 }], [{ "node": "UAZAPI Listar Contatos", "type": "main", "index": 0 }], [{ "node": "Enviar Resposta ao Usuario", "type": "main", "index": 0 }] ] }, "UAZAPI Enviar Texto": { "main": [[{ "node": "Enviar Resposta ao Usuario", "type": "main", "index": 0 }]] }, "UAZAPI Enviar Imagem": { "main": [[{ "node": "Enviar Resposta ao Usuario", "type": "main", "index": 0 }]] }, "UAZAPI Criar Grupo": { "main": [[{ "node": "Enviar Resposta ao Usuario", "type": "main", "index": 0 }]] }, "UAZAPI Add Participante": { "main": [[{ "node": "Enviar Resposta ao Usuario", "type": "main", "index": 0 }]] }, "UAZAPI Remove Participante": { "main": [[{ "node": "Enviar Resposta ao Usuario", "type": "main", "index": 0 }]] }, "UAZAPI Listar Grupos": { "main": [[{ "node": "Enviar Resposta ao Usuario", "type": "main", "index": 0 }]] }, "UAZAPI Listar Contatos": { "main": [[{ "node": "Enviar Resposta ao Usuario", "type": "main", "index": 0 }]] }, "Enviar Resposta ao Usuario": { "main": [[{ "node": "Responder Webhook", "type": "main", "index": 0 }]] } }, "settings": { "executionOrder": "v1" } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pabloweyne/uazapi-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server