Wizebot icon

Wizebot

Consumir API WhatsApp da Wizebot

Overview

This node integrates with the Wizebot WhatsApp API, enabling various WhatsApp-related operations such as sending messages, managing subscribers (contacts), handling conversations, working with catalogs and orders, and processing media content using OpenAI services. It is useful for automating WhatsApp communication workflows, customer support, marketing campaigns, and chatbot interactions.

Common scenarios include:

  • Sending WhatsApp messages to any phone number.
  • Retrieving conversation history with a specific subscriber.
  • Managing subscriber data (create, update, delete).
  • Triggering bot flows on WhatsApp.
  • Assigning chats to team members or tagging subscribers.
  • Listing and managing labels, catalogs, and catalog orders.
  • Processing incoming WhatsApp media (audio, images, PDFs) with AI-powered transcription and analysis.

Practical examples:

  • Automatically send promotional messages to customers.
  • Fetch recent chat messages for customer service follow-up.
  • Update subscriber information based on CRM data.
  • Use OpenAI to transcribe voice notes or analyze images sent via WhatsApp.

Properties

Name Meaning
Operação The operation to perform. Options include: Enviar Mensagem, Obter Conversa, Listar Modelos, Acionar Bot, Obter Assinante, Listar Assinantes, Criar Assinante, Atualizar Assinante, Redefinir Fluxo de Entrada, Atribuir Chat à Equipe, Atribuir Campos Personalizados, Atribuir Etiquetas, Remover Etiquetas, Listar Etiquetas, Criar Etiqueta, Listar Catálogos, Listar Pedidos de Catálogo, Alterar Status do Pedido, Deletar Assinante, Processar Mídia.
Mensagem Text content of the message to send (required for "Enviar Mensagem").
Número de Telefone Phone number including country code, numeric only. Used in many operations like sending messages, getting conversations, updating subscribers, etc.
Limite Number limit for fetching messages or subscribers (used in "Obter Conversa" and "Listar Assinantes").
Deslocamento Pagination offset for listing messages or subscribers.
ID Único do Fluxo do Bot Unique identifier of the bot flow to trigger (used in "Acionar Bot").
Nome Subscriber's name (used in "Criar Assinante").
Número de Telefone (criarAssinante) Phone number of subscriber with country code, no "+" sign (used in "Criar Assinante").
Primeiro Nome Subscriber's first name (optional, used in "Atualizar Assinante").
Sobrenome Subscriber's last name (optional, used in "Atualizar Assinante").
Gênero Subscriber's gender (optional, used in "Atualizar Assinante").
IDs de Etiquetas Comma-separated label IDs (e.g., "1,4,5") for assigning or removing labels or updating subscriber labels.
ID do Membro da Equipe Team member ID to assign a chat to (used in "Atribuir Chat à Equipe").
Campos Personalizados (JSON) JSON object with custom field names and values to assign to a subscriber (used in "Atribuir Campos Personalizados").
Nome da Etiqueta Name of the label to create (used in "Criar Etiqueta").
ID do Catálogo WhatsApp WhatsApp catalog ID for filtering catalog order listings (used in "Listar Pedidos de Catálogo").
ID Único do Pedido Unique order ID for changing order status (used in "Alterar Status do Pedido").
Processar Automaticamente Boolean to automatically extract data from WizeBot webhook (used in "Processar Mídia").
Mensagem do Webhook Raw message received from WizeBot webhook (used in manual mode of "Processar Mídia").
ID do Chat Phone number of the chat (used in "Processar Mídia").
Nome do Contato Contact's name (optional, used in "Processar Mídia").
Processar Áudio Enable processing of audio messages (used in "Processar Mídia").
Processar Imagem Enable processing of image messages (used in "Processar Mídia").
Processar PDF Enable processing of PDF documents (used in "Processar Mídia").
Prompt para Análise de Imagem Custom prompt text for image analysis by OpenAI (used in "Processar Mídia" when processing images).
Modelo para Imagem OpenAI model to use for image analysis: GPT-4 Vision, GPT-4o, GPT-4o-mini (used in "Processar Mídia").
Modelo para Áudio OpenAI model to use for audio transcription: Whisper-1 (used in "Processar Mídia").
Status do Carrinho Cart/order status value for updating order status. Options: Aprovado, Concluído, Enviado, Entregue, Reembolsado (used in "Alterar Status do Pedido").

Output

The node outputs JSON data corresponding to the response from the Wizebot API for each operation. The structure varies depending on the operation:

  • For messaging and subscriber management operations, the output contains confirmation or data objects returned by the API.
  • For conversation retrieval, it returns message lists with metadata.
  • For catalog and order operations, it returns lists or status update confirmations.
  • For media processing ("Processar Mídia"), the output includes:
    • first_name: Contact's first name.
    • phone: Phone number of the chat.
    • message: Transcribed or analyzed text result from media.
    • type: Type of media processed (e.g., "text", "audio", "image", "document").
    • url: URL of the media (if applicable).

If media processing is enabled, the node can output binary data indirectly by fetching media URLs and processing them through OpenAI models, but the final output is textual transcription or description.

Dependencies

  • Requires an API token credential for the Wizebot WhatsApp API.
  • Optionally requires an OpenAI API key credential for media processing operations.
  • Uses external services:
    • Wizebot API endpoints for WhatsApp operations.
    • OpenAI API for audio transcription (Whisper) and image/document analysis (GPT-4 variants).
  • Uses axios for HTTP requests.
  • Uses pdf-parse library for extracting text from PDF documents.

Troubleshooting

  • Unknown Operation Error: If an unsupported operation is selected, the node throws an error indicating the operation is unknown. Ensure the operation name matches one of the supported options.
  • Invalid Media Format: When manually inputting media for processing, the format must be #ATTACHMENT:type#url. Incorrect formatting will cause errors.
  • Webhook Data Structure Issues: Automatic media processing expects a specific webhook JSON structure with a body containing user_message. If this is missing or malformed, disable automatic processing or verify webhook payload.
  • OpenAI API Errors: Errors during media processing may occur due to invalid API keys, rate limits, or unexpected responses. Check OpenAI credentials and usage limits.
  • Phone Number Format: Phone numbers must start with the country code and contain only numeric characters. Invalid formats will cause API errors.
  • Label IDs Format: Label IDs must be comma-separated strings without spaces. Incorrect formatting may cause failures in assigning/removing labels.

Links and References

Discussion