### Install and Enable Nginx Source: https://docs.evolutionfoundation.com.br/evolution-api/install/nginx Installs Nginx, starts the service, and enables it to run on boot. Check the status to confirm it's running. ```bash apt-get install -y nginx systemctl start nginx systemctl enable nginx systemctl status nginx ``` -------------------------------- ### Start Evolution API with PM2 Source: https://docs.evolutionfoundation.com.br/evolution-api/updates Use this command to start the Evolution API process using PM2. Ensure PM2 is installed and the API is configured. ```bash pm2 start ApiEvolution ``` -------------------------------- ### Start API with PM2 Source: https://docs.evolutionfoundation.com.br/evolution-api/install/nvm Start the Evolution API using PM2, naming the process 'ApiEvolution', and configure PM2 to start on system startup. ```bash pm2 start 'npm run start:prod' --name ApiEvolution pm2 startup pm2 save --force ``` -------------------------------- ### Build and Start Production API Source: https://docs.evolutionfoundation.com.br/evolution-api/install/nvm Build the application for production and then start the API in production mode. ```bash npm run build npm run start:prod ``` -------------------------------- ### Install Docker Source: https://docs.evolutionfoundation.com.br/evolution-api/install/docker Downloads and executes the official Docker installation script. This is the recommended method for installing Docker on various Linux distributions. ```bash curl -fsSL https://get.docker.com | bash ``` -------------------------------- ### Install Project Dependencies Source: https://docs.evolutionfoundation.com.br/evolution-api/install/nvm Navigate into the cloned project directory and install all necessary Node.js dependencies using npm. ```bash cd evolution-api npm install ``` -------------------------------- ### Start Redis Server Service Source: https://docs.evolutionfoundation.com.br/evolution-api/requirements/redis Start the Redis server service after installation on Ubuntu. This command ensures Redis runs in the background. ```bash sudo service redis-server start ``` -------------------------------- ### Install Redis Server on Ubuntu Source: https://docs.evolutionfoundation.com.br/evolution-api/requirements/redis Install the Redis server package on Ubuntu systems. This is the first step for local Redis installation. ```bash sudo apt-get update sudo apt-get install redis-server ``` -------------------------------- ### Install NVM Source: https://docs.evolutionfoundation.com.br/evolution-api/install/nvm Download and install the NVM script. This is the first step to manage Node.js versions. ```bash curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash ``` -------------------------------- ### Execute SetupOrion Installer Source: https://docs.evolutionfoundation.com.br/evolution-api/install/setup-orion Run this command on a clean VPS to initiate the automated installation of Evolution API infrastructure. Ensure you have a Debian 11 or Ubuntu 20.04 system and root access. ```bash bash <(curl -sSL setup.oriondesign.art.br) ``` -------------------------------- ### Create Environment File Source: https://docs.evolutionfoundation.com.br/evolution-api/install/nvm Copy the example environment file to create a new .env file for custom configurations. ```bash cp ./.env.example ./.env ``` -------------------------------- ### Minio Configuration Example Source: https://docs.evolutionfoundation.com.br/evolution-api/integrations/s3minio Example configuration for using Minio, specifying a custom domain for the endpoint. ```plaintext S3_ENABLED=true S3_ACCESS_KEY=your-minio-access-key S3_SECRET_KEY=your-minio-secret-key S3_BUCKET=my-minio-bucket S3_PORT=443 S3_ENDPOINT=minio.mycompany.com S3_USE_SSL=true ``` -------------------------------- ### Install and Use Node.js with NVM Source: https://docs.evolutionfoundation.com.br/evolution-api/install/nvm Load NVM into the current environment and then install and use a specific Node.js version required by the Evolution API. ```bash # Load NVM into the current environment source ~/.bashrc # Install and use the required Node.js version nvm install v20.10.0 && nvm use v20.10.0 ``` -------------------------------- ### Install PM2 Process Manager Source: https://docs.evolutionfoundation.com.br/evolution-api/install/nvm Install PM2 globally to manage the Node.js application process. ```bash npm install pm2 -g ``` -------------------------------- ### Verify NVM Installation Source: https://docs.evolutionfoundation.com.br/evolution-api/install/nvm Check if NVM has been installed correctly by verifying its command availability. ```bash command -v nvm ``` -------------------------------- ### Start Typebot Instance (HTTP POST) Source: https://docs.evolutionfoundation.com.br/evolution-api/integrations/typebot Use this endpoint to initiate a Typebot session via the Evolution API. Ensure the `baseUrl` and `instance` are correctly configured. ```http POST {{baseUrl}}/typebot/start/{{instance}} ``` -------------------------------- ### Install Certbot for SSL Source: https://docs.evolutionfoundation.com.br/evolution-api/install/nginx Installs Certbot, a tool for automatically obtaining and renewing SSL certificates, using the snap package manager. ```bash snap install --classic certbot ``` -------------------------------- ### Install N8N Community Node for Evolution API Source: https://docs.evolutionfoundation.com.br/evolution-api/integrations/n8n-community-node Use this command in the N8N community nodes installation field to add the Evolution API node. Ensure you accept the terms of use. ```bash n8n-nodes-evolution-api ``` -------------------------------- ### Initialize Docker Services Source: https://docs.evolutionfoundation.com.br/evolution-api/install/docker Starts the Evolution API and any other defined services in detached mode using Docker Compose. ```bash docker compose up -d ``` -------------------------------- ### Start Redis with Docker Compose Source: https://docs.evolutionfoundation.com.br/evolution-api/requirements/redis Use this command to start a Redis instance in detached mode using Docker Compose. ```bash docker-compose up -d ``` -------------------------------- ### Amazon S3 Configuration Example Source: https://docs.evolutionfoundation.com.br/evolution-api/integrations/s3minio Example configuration for using Amazon S3, ensuring the endpoint includes the correct region. ```plaintext S3_ENABLED=true S3_ACCESS_KEY=your-aws-access-key S3_SECRET_KEY=your-aws-secret-key S3_BUCKET=my-s3-bucket S3_PORT=443 S3_ENDPOINT=s3.eu-west-3.amazonaws.com S3_USE_SSL=true S3_REGION=eu-west-3 ``` -------------------------------- ### Create Evolution API Instance using cURL Source: https://docs.evolutionfoundation.com.br/evolution-api/integrations/evolution-channel Example cURL command to create an instance for the Evolution Channel. Replace API_URL and instance details with your specific values. ```bash curl -X POST http://API_URL/instance/create \ -H "Content-Type: application/json" \ -d '{ "instanceName": "MinhaInstancia", "token": "123456", "number": "9876543210", "qrcode": false, "integration": "EVOLUTION" }' ``` -------------------------------- ### Clean NPM Installation Source: https://docs.evolutionfoundation.com.br/evolution-api/updates Remove the existing `node_modules` directory to prevent conflicts and then install the necessary Node.js dependencies for the updated version using NPM. ```shell # Remover o diretório node_modules atual para garantir uma instalação limpa rm -rf node_modules # Instalar dependências com NPM npm i ``` -------------------------------- ### Start API with Increased Memory Allocation using PM2 Source: https://docs.evolutionfoundation.com.br/evolution-api/install/nvm Start the API with PM2, allocating more memory (4GB) and setting a restart policy for applications with higher memory requirements. ```bash pm2 start 'npm run start:prod' --name ApiEvolution -- start --node-args="--max-old-space-size=4096" --max-memory-restart 4G ``` -------------------------------- ### Create WhatsApp Instance cURL Request Source: https://docs.evolutionfoundation.com.br/evolution-api/integrations/cloudapi Example cURL command to send a POST request to the Evolution API v2 to create a WhatsApp instance. This demonstrates how to structure the request with the necessary JSON body. ```bash curl -X POST http://API_URL/instance/create \ -H "Content-Type: application/json" \ -d '{ "instanceName": "MinhaInstancia", "token": "EAAGm0PX4ZCpsBA...", "number": "1234567890", "businessId": "9876543210", "qrcode": false, "integration": "WHATSAPP-BUSINESS" }' ``` -------------------------------- ### Initialize Docker Swarm Source: https://docs.evolutionfoundation.com.br/evolution-api/install/docker Starts a new Docker Swarm cluster. The `--advertise-addr` flag specifies the IP address that other nodes will use to connect to this manager. ```bash docker swarm init --advertise-addr IP_SERVER ``` -------------------------------- ### Update System Packages Source: https://docs.evolutionfoundation.com.br/evolution-api/install/docker Ensures the system has the latest package information and installs apparmor-utils, which is a prerequisite for Docker on some systems. ```bash sudo apt-get update && apt-get install -y apparmor-utils ``` -------------------------------- ### Default Typebot Configuration JSON Source: https://docs.evolutionfoundation.com.br/evolution-api/integrations/typebot Example JSON for setting default Typebot configurations. These values are used if not specified during bot creation. ```json { "expire": 20, "keywordFinish": "#SAIR", "delayMessage": 1000, "unknownMessage": "Mensagem não reconhecida", "listeningFromMe": false, "stopBotFromMe": false, "keepOpen": false, "debounceTime": 10, "ignoreJids": [], "typebotIdFallback": "clyja4oys0a3uqpy7k3bd7swe" } ``` -------------------------------- ### Typebot Configuration JSON Source: https://docs.evolutionfoundation.com.br/evolution-api/integrations/typebot Example JSON body for configuring a Typebot. Set parameters like enabled status, URL, trigger conditions, and message handling. ```json { "enabled": true, "url": "https://bot.dgcode.com.br", "typebot": "my-typebot-uoz1rg9", "triggerType": "keyword", "triggerOperator": "regex", "triggerValue": "^atend.*", "expire": 20, "keywordFinish": "#SAIR", "delayMessage": 1000, "unknownMessage": "Mensagem não reconhecida", "listeningFromMe": false, "stopBotFromMe": false, "keepOpen": false, "debounceTime": 10 } ``` -------------------------------- ### OpenAPI Specification for Fetch All Instances Source: https://docs.evolutionfoundation.com.br/evolution-api/fetch-all-instances This OpenAPI 3.0.4 specification defines the GET /instance/fetchInstances endpoint. It includes server URLs, security schemes, request/response schemas, and examples for various HTTP status codes. ```yaml openapi: 3.0.4 info: title: Evolution Foundation - Evolution API - Instance description: Main Evolution API for WhatsApp version: 2.3.7 servers: - url: http://localhost:8080 description: Local development server - url: https://api.evolution-api.com description: Production server - url: '{customUrl}' description: Custom server variables: customUrl: default: https://your-instance.com description: Enter your server URL security: - ApiKeyAuth: [] paths: /instance/fetchInstances: get: summary: Fetch All Instances description: Get list of all instances responses: '200': description: List of instances content: application/json: schema: type: array items: $ref: '#/components/schemas/InstanceResponse' '400': description: Bad Request (invalid data) content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: success: false error: code: BAD_REQUEST message: Invalid request parameters meta: timestamp: '2024-01-15T10:30:00Z' path: /instance/fetchInstances method: GET '401': description: Unauthorized (invalid or missing token) content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: success: false error: code: UNAUTHORIZED message: Invalid or missing authentication token meta: timestamp: '2024-01-15T10:30:00Z' path: /instance/fetchInstances method: GET '403': description: Forbidden (insufficient permissions) content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: success: false error: code: FORBIDDEN message: Insufficient permissions to perform this action meta: timestamp: '2024-01-15T10:30:00Z' path: /instance/fetchInstances method: GET '404': description: Not Found (resource not found) content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: success: false error: code: NOT_FOUND message: Resource not found meta: timestamp: '2024-01-15T10:30:00Z' path: /instance/fetchInstances method: GET '500': description: Internal Server Error (server error) content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: success: false error: code: INTERNAL_SERVER_ERROR message: An unexpected error occurred meta: timestamp: '2024-01-15T10:30:00Z' path: /instance/fetchInstances method: GET components: schemas: InstanceResponse: type: object properties: instance: type: object properties: instanceName: type: string status: type: string qrcode: type: object nullable: true connectionStatus: type: object ErrorResponse: type: object required: - success - error properties: success: type: boolean example: false error: type: object required: - code - message properties: code: type: string message: type: string meta: type: object properties: timestamp: type: string format: date-time path: type: string method: type: string securitySchemes: ApiKeyAuth: type: apiKey in: header name: apikey description: API Key for authentication (global or instance-specific) ``` -------------------------------- ### Instalar PostgreSQL Localmente (Ubuntu) Source: https://docs.evolutionfoundation.com.br/evolution-api/requirements/database Comandos para instalar o PostgreSQL e suas contribuições em sistemas Ubuntu. Após a instalação, o serviço pode ser iniciado. ```bash sudo apt-get update sudo apt-get install postgresql postgresql-contrib ``` -------------------------------- ### Instalar MySQL Localmente (Ubuntu) Source: https://docs.evolutionfoundation.com.br/evolution-api/requirements/database Comandos para instalar o servidor MySQL em sistemas Ubuntu. Após a instalação, o serviço pode ser iniciado. ```bash sudo apt-get update sudo apt-get install mysql-server ``` -------------------------------- ### POST /typebot/start/{instance} Source: https://docs.evolutionfoundation.com.br/evolution-api/integrations/typebot Initiates a Typebot session by sending a POST request to the specified instance. This endpoint allows for active bot initiation with custom variables. ```APIDOC ## POST /typebot/start/{instance} ### Description Initiates a Typebot session by sending a POST request to the specified instance. This endpoint allows for active bot initiation with custom variables. ### Method POST ### Endpoint `{{baseUrl}}/typebot/start/{{instance}}` ### Parameters #### Request Body - **url** (string) - Required - URL of the Typebot API (without trailing '/'). - **typebot** (string) - Required - Public name of the bot in Typebot. - **remoteJid** (string) - Required - JID (identifier) of the WhatsApp contact. - **startSession** (boolean) - Optional - Defines if the session should be initiated with the bot (`true` or `false`). Defaults to `false`. - **variables** (array) - Optional - Custom variables that can be passed to the bot. - **name** (string) - Required - The name of the variable. - **value** (string) - Required - The value of the variable. ### Request Example ```json { "url": "https://bot.dgcode.com.br", "typebot": "fluxo-unico-3uuso28", "remoteJid": "557499879409@s.whatsapp.net", "startSession": false, "variables": [ { "name": "pushName", "value": "Davidson Gomes" } ] } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message of the session start. #### Response Example ```json { "message": "Typebot session started successfully." } ``` #### Error Response (400) - **error** (string) - Description of the error. #### Error Response Example ```json { "error": "Invalid request payload." } ``` ``` -------------------------------- ### Error Response Example Source: https://docs.evolutionfoundation.com.br/evolution-api/find-chats This example shows the structure of an error response from the findChats endpoint, including error code, message, and metadata. ```json { "success": false, "error": { "code": "BAD_REQUEST", "message": "Invalid request parameters" }, "meta": { "timestamp": "2024-01-15T10:30:00Z", "path": "/chat/findChats/{instanceName}", "method": "POST" } } ``` -------------------------------- ### Iniciar Serviço PostgreSQL Localmente Source: https://docs.evolutionfoundation.com.br/evolution-api/requirements/database Comando para iniciar o serviço PostgreSQL no sistema operacional. Certifique-se de que o PostgreSQL esteja instalado. ```bash sudo service postgresql start ``` -------------------------------- ### Iniciar Serviço MySQL Localmente Source: https://docs.evolutionfoundation.com.br/evolution-api/requirements/database Comando para iniciar o serviço MySQL no sistema operacional. Certifique-se de que o MySQL Server esteja instalado. ```bash sudo service mysql start ``` -------------------------------- ### Connect Instance Source: https://docs.evolutionfoundation.com.br/evolution-api/connect-instance Initiates the connection of a WhatsApp instance. This endpoint requires the instance name as a path parameter. ```APIDOC ## GET /instance/connect/{instanceName} ### Description Connect instance to WhatsApp. ### Method GET ### Endpoint /instance/connect/{instanceName} ### Parameters #### Path Parameters - **instanceName** (string) - Required - WhatsApp instance name ### Response #### Success Response (200) - **pairingCode** (string) - nullable - Example: null - **code** (string) - Example: 2@exemple - **base64** (string) - Example: data:image/png;base64,exemple - **count** (integer) - Example: 1 #### Response Example { "pairingCode": null, "code": "2@exemple", "base64": "data:image/png;base64,exemple", "count": 1 } ERROR HANDLING: - **400 Bad Request**: Invalid request parameters. - **401 Unauthorized**: Invalid or missing token. - **403 Forbidden**: Insufficient permissions. - **404 Not Found**: Instance not found. - **500 Internal Server Error**: An unexpected error occurred. ``` -------------------------------- ### Deploy Database Migrations Source: https://docs.evolutionfoundation.com.br/evolution-api/install/nvm Apply the database migrations to set up the database schema using the npm script. ```bash npm run db:deploy ``` -------------------------------- ### Request Body for Starting Typebot Source: https://docs.evolutionfoundation.com.br/evolution-api/integrations/typebot This JSON payload is used to actively start a bot session. It includes the API URL, Typebot identifier, recipient's WhatsApp ID, and optional custom variables. ```json { "url": "https://bot.dgcode.com.br", "typebot": "fluxo-unico-3uuso28", "remoteJid": "557499879409@s.whatsapp.net", "startSession": false, "variables": [ { "name": "pushName", "value": "Davidson Gomes" } ] } ``` -------------------------------- ### Webhook with speechToText Source: https://docs.evolutionfoundation.com.br/evolution-api/integrations/openai Example of a webhook payload when the `speechToText` parameter is activated, including the transcribed audio. ```APIDOC ### Webhook with `speechToText` When the `speechToText` parameter is activated, the Evolution API automatically converts received audios to text using the OpenAI credential. The transcription of the audio is then included in the webhook sent by the API. #### Example of Webhook with `speechToText` ```json { "event": "message", "data": { "message": { "id": "message-id", "from": "sender-number", "to": "receiver-number", "content": "Text message", "speechToText": "This is the transcribed text from the audio." } } } ``` ``` -------------------------------- ### Generate Prisma Client Source: https://docs.evolutionfoundation.com.br/evolution-api/install/nvm Run the npm script to generate the Prisma client, which is necessary for database interactions. ```bash npm run db:generate ``` -------------------------------- ### Webhook with Media URL Source: https://docs.evolutionfoundation.com.br/evolution-api/integrations/s3minio Example of a webhook payload showing the 'mediaUrl' field for a stored media file. ```json { "event": "messages.upsert", "data": { "message": { ... "mediaUrl": "https://files.evolution-api-pro.com/bucket/path/to/media/file.jpg", ... } } } ``` -------------------------------- ### Create Nginx Configuration File Source: https://docs.evolutionfoundation.com.br/evolution-api/install/nginx Creates a new Nginx configuration file using the nano text editor. This is where you'll define your server settings. ```bash nano /etc/nginx/conf.d/default.conf ``` -------------------------------- ### POST /evoai/settings/{{instance}} Source: https://docs.evolutionfoundation.com.br/evolution-api/integrations/evoai Endpoint for setting default configurations for EvoAI bots. These settings will be applied if parameters are not provided during bot creation. ```APIDOC ## POST /evoai/settings/{{instance}} ### Description Endpoint for setting default configurations for EvoAI bots. These settings will be applied if parameters are not provided during bot creation. ### Method POST ### Endpoint /evoai/settings/{{instance}} ### Request Body - **expire** (integer) - Optional - Time in minutes after which the bot expires. - **keywordFinish** (string) - Optional - Keyword that ends the bot session. - **delayMessage** (integer) - Optional - Delay in milliseconds to simulate typing before sending a message. - **unknownMessage** (string) - Optional - Message sent when user input is not recognized. - **listeningFromMe** (boolean) - Optional - Determines if the bot should listen to messages sent by the user. - **stopBotFromMe** (boolean) - Optional - Determines if the bot should stop when the user sends a message. - **keepOpen** (boolean) - Optional - Keeps the session open, preventing the bot from restarting for the same contact. - **debounceTime** (integer) - Optional - Time in seconds to combine multiple messages into one. - **ignoreJids** (array) - Optional - List of contact JIDs that will not trigger the bot. - **evoaiIdFallback** (string) - Optional - The fallback bot ID to be used if no triggers are activated. ### Request Example ```json { "expire": 20, "keywordFinish": "#SAIR", "delayMessage": 1000, "unknownMessage": "Mensagem não reconhecida", "listeningFromMe": false, "stopBotFromMe": false, "keepOpen": false, "debounceTime": 0, "ignoreJids": [], "evoaiIdFallback": "clyja4oys0a3uqpy7k3bd7swe" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message of default settings update. #### Response Example ```json { "message": "Default settings updated successfully" } ``` ``` -------------------------------- ### POST /typebot/start/{{instance}} - Active Bot Initialization Source: https://docs.evolutionfoundation.com.br/evolution-api/integrations/typebot Initiates a Typebot instance actively for a specific contact, bypassing the need for triggers. ```APIDOC ## POST /typebot/start/{{instance}} ### Description Actively initializes a Typebot for a specific contact. ### Method POST ### Endpoint `{{baseUrl}}/typebot/start/{{instance}}` ### Parameters #### Request Body - **remoteJid** (string) - Required - JID of the contact to start the bot for. - **typebotId** (string) - Required - The ID of the Typebot to initiate. - **variables** (object) - Optional - Key-value pairs for initial variables to pass to the bot. ``` -------------------------------- ### Get Group Info Source: https://docs.evolutionfoundation.com.br/evolution-api/get-group-info Retrieves information for a specified WhatsApp group. Requires the instance name and the group's JID. ```APIDOC ## GET /group/findGroupInfos/{instanceName} ### Description Get group information. ### Method GET ### Endpoint /group/findGroupInfos/{instanceName} ### Parameters #### Path Parameters - **instanceName** (string) - Required - WhatsApp instance name #### Query Parameters - **groupJid** (string) - Required - WhatsApp group JID ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **group** (object) - Contains the group details. - **id** (string) - The group's unique identifier. - **subject** (string) - The group's name or subject. - **creation** (string) - The timestamp when the group was created. - **owner** (string) - The JID of the group owner. #### Response Example ```json { "success": true, "group": { "id": "120363123456789012@g.us", "subject": "My Group", "creation": "1234567890", "owner": "5511999999999@c.us" } } ``` #### Error Response (400, 401, 403, 404, 500) - **success** (boolean) - Indicates if the operation was successful. - **error** (object) - Contains error details. - **code** (string) - The error code. - **message** (string) - A description of the error. - **meta** (object) - Metadata about the error. - **timestamp** (string) - The time the error occurred. - **path** (string) - The endpoint path. - **method** (string) - The HTTP method used. #### Error Response Example (400) ```json { "success": false, "error": { "code": "BAD_REQUEST", "message": "Invalid request data" }, "meta": { "timestamp": "2024-01-15T10:30:00Z", "path": "/group/findGroupInfos/{instanceName}", "method": "GET" } } ``` ``` -------------------------------- ### EvoAI Automatic Variables Source: https://docs.evolutionfoundation.com.br/evolution-api/integrations/evoai These variables are automatically provided by EvoAI when a session starts. They contain essential information about the contact and the API instance. ```json inputs: { remoteJid: "JID do contato", pushName: "Nome do contato", instanceName: "Nome da instância", serverUrl: "URL do servidor API", apiKey: "Chave da API Evolution" }; ``` -------------------------------- ### Criar Banco de Dados MySQL para Evolution API v2 Source: https://docs.evolutionfoundation.com.br/evolution-api/requirements/database Comando para criar um novo banco de dados chamado 'evolution' no MySQL. Requer que o servidor MySQL esteja em execução e acesso com senha. ```bash mysql -u root -p -e "CREATE DATABASE evolution;" ``` -------------------------------- ### Obter QR Code para conexão Source: https://docs.evolutionfoundation.com.br/evolution-api/installation Após criar uma instância, use este comando curl para obter o QR Code necessário para conectar seu celular ao WhatsApp. Substitua 'minha-instancia' pelo nome da sua instância e 'sua-chave-segura-aqui' pela sua chave de API. ```bash curl http://localhost:8080/instance/connect/minha-instancia \ -H "apikey: sua-chave-segura-aqui" ``` -------------------------------- ### Webhook URL Construction for Events Source: https://docs.evolutionfoundation.com.br/evolution-api/configuration/webhooks When WEBHOOK_BY_EVENTS is enabled, event names are appended to the base webhook URL. For example, 'APPLICATION_STARTUP' becomes '/application-startup'. ```text https://sub.domain.com/webhook/application-startup ``` ```text https://sub.domain.com/webhook/qrcode-updated ``` ```text https://sub.domain.com/webhook/connection-update ``` ```text https://sub.domain.com/webhook/messages-set ``` ```text https://sub.domain.com/webhook/messages-upsert ``` ```text https://sub.domain.com/webhook/messages-update ``` ```text https://sub.domain.com/webhook/messages-delete ``` ```text https://sub.domain.com/webhook/send-message ``` ```text https://sub.domain.com/webhook/contacts-set ``` ```text https://sub.domain.com/webhook/contacts-upsert ``` ```text https://sub.domain.com/webhook/contacts-update ``` ```text https://sub.domain.com/webhook/presence-update ``` ```text https://sub.domain.com/webhook/chats-set ``` ```text https://sub.domain.com/webhook/chats-update ``` ```text https://sub.domain.com/webhook/chats-upsert ``` ```text https://sub.domain.com/webhook/chats-delete ``` ```text https://sub.domain.com/webhook/groups-upsert ``` ```text https://sub.domain.com/webhook/groups-update ``` ```text https://sub.domain.com/webhook/group-participants-update ``` ```text https://sub.domain.com/webhook/new-jwt ``` -------------------------------- ### S3 Configuration Variables Source: https://docs.evolutionfoundation.com.br/evolution-api/integrations/s3minio Set these environment variables to enable and configure S3 or Minio storage for WhatsApp media files. ```plaintext S3_ENABLED=true S3_ACCESS_KEY=lJiKQSKlco6UfSUJSnZt S3_SECRET_KEY=gZXkzkXQwhME8XEmZVNF0ImSWxIpbXeJ5UoPy4s1 S3_BUCKET=evolution S3_PORT=443 S3_ENDPOINT=s3.eu-west-3.amazonaws.com S3_USE_SSL=true S3_REGION=eu-west-3 ``` -------------------------------- ### Dify Automatic Variables for Sessions Source: https://docs.evolutionfoundation.com.br/evolution-api/integrations/dify These variables are automatically provided when a Dify session starts. They include contact and server details necessary for bot interactions. ```json inputs: { remoteJid: "JID do contato", pushName: "Nome do contato", instanceName: "Nome da instância", serverUrl: "URL do servidor da API", apiKey: "Chave de API da Evolution" }; ``` -------------------------------- ### Webhook Localization Endpoint Source: https://docs.evolutionfoundation.com.br/evolution-api/configuration/webhooks Use this GET method to find any active webhook on a specific instance. The response provides details about the webhook's configuration. ```http GET [baseUrl]/webhook/find/[instance] ``` -------------------------------- ### Create Instance with Chatwoot Configuration Source: https://docs.evolutionfoundation.com.br/evolution-api/integrations/chatwoot Use this JSON body when creating a new instance via the /instance/create endpoint to enable Chatwoot integration. Ensure all Chatwoot-specific fields are correctly populated. ```json { "instanceName": "NOME DA INSTANCIA", "number": "NUMERO DO WHATSAPP PARA GERAR O PAIRING CODE", "qrcode": true, "integration": "WHATSAPP-BAILEYS", "chatwootAccountId": "1", "chatwootToken": "TOKEN", "chatwootUrl": "https://chatwoot.com", "chatwootSignMsg": true, "chatwootReopenConversation": true, "chatwootConversationPending": false, "chatwootImportContacts": true, "chatwootNameInbox": "evolution", "chatwootMergeBrazilContacts": true, "chatwootImportMessages": true, "chatwootDaysLimitImportMessages": 3, "chatwootOrganization": "Evolution Bot", "chatwootLogo": "https://evolution-api.com/files/evolution-api-favicon.png" } ``` -------------------------------- ### Enable Virtual Host Configuration Source: https://docs.evolutionfoundation.com.br/evolution-api/install/nginx Creates a symbolic link to enable the custom virtual host configuration. This makes Nginx aware of the new site. ```bash ln -s /etc/nginx/sites-available/api /etc/nginx/sites-enabled nginx -t ``` -------------------------------- ### Webhook Payload with Speech-to-Text Transcription Source: https://docs.evolutionfoundation.com.br/evolution-api/integrations/openai This JSON example shows a webhook payload when the `speechToText` feature is enabled. It includes the transcribed text from an audio message in the `speechToText` field. ```json { "event": "message", "data": { "message": { "id": "message-id", "from": "sender-number", "to": "receiver-number", "content": "Text message", "speech ToText": "This is the transcribed text from the audio." } } } ``` -------------------------------- ### Criar Banco de Dados PostgreSQL para Evolution API v2 Source: https://docs.evolutionfoundation.com.br/evolution-api/requirements/database Comando para criar um novo banco de dados chamado 'evolution' usando o usuário 'postgres'. Requer que o serviço PostgreSQL esteja em execução. ```bash sudo -u postgres createdb evolution ``` -------------------------------- ### POST /evoai/create/{{instance}} Source: https://docs.evolutionfoundation.com.br/evolution-api/integrations/evoai Endpoint for creating and configuring bots within the EvoAI platform. This allows for setting up various interaction triggers and bot behaviors. ```APIDOC ## POST /evoai/create/{{instance}} ### Description Endpoint for creating and configuring bots within the EvoAI platform. This allows for setting up various interaction triggers and bot behaviors. ### Method POST ### Endpoint /evoai/create/{{instance}} ### Request Body - **enabled** (boolean) - Required - Activates or deactivates the bot. - **agentUrl** (string) - Required - The URL of the EvoAI API (without a trailing '/'). - **apiKey** (string) - Required - The API key provided by EvoAI. - **triggerType** (string) - Optional - Type of trigger to initiate the bot ('all' or 'keyword'). - **triggerOperator** (string) - Optional - Operator used to evaluate the trigger ('contains', 'equals', 'startsWith', 'endsWith', 'regex', 'none'). - **triggerValue** (string) - Optional - Value used in the trigger (e.g., a keyword or regex). - **expire** (integer) - Optional - Time in minutes after which the bot expires. - **keywordFinish** (string) - Optional - Keyword that ends the bot session. - **delayMessage** (integer) - Optional - Delay in milliseconds to simulate typing before sending a message. - **unknownMessage** (string) - Optional - Message sent when user input is not recognized. - **listeningFromMe** (boolean) - Optional - Determines if the bot should listen to messages sent by the user. - **stopBotFromMe** (boolean) - Optional - Determines if the bot should stop when the user sends a message. - **keepOpen** (boolean) - Optional - Keeps the session open, preventing the bot from restarting for the same contact. - **debounceTime** (integer) - Optional - Time in seconds to combine multiple messages into one. - **ignoreJids** (array) - Optional - List of contact JIDs that will not trigger the bot. ### Request Example ```json { "enabled": true, "agentUrl": "http://evoai.site.com/v1", "apiKey": "app-123456", "triggerType": "keyword", "triggerOperator": "equals", "triggerValue": "test", "expire": 0, "keywordFinish": "#SAIR", "delayMessage": 1000, "unknownMessage": "Mensagem não reconhecida", "listeningFromMe": false, "stopBotFromMe": false, "keepOpen": false, "debounceTime": 0, "ignoreJids": [] } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message of bot creation. #### Response Example ```json { "message": "Bot created successfully" } ``` ``` -------------------------------- ### Incoming Message Payload Example Source: https://docs.evolutionfoundation.com.br/evolution-api/integrations/evolution-channel This JSON structure represents the payload received by the Evolution Channel webhook when a message is sent to your instance. It contains details about the sender and the message content. ```json { "numberId": "1234567", "key": { "remoteJid": "557499879409", "fromMe": false, "id": "ABC1234" }, "pushName": "Davidson", "message": { "conversation": "Qual o seu nome?" }, "messageType": "conversation" } ``` -------------------------------- ### POST /openai/changeStatus/{{instance}} - Manage OpenAI Bot Sessions Source: https://docs.evolutionfoundation.com.br/evolution-api/integrations/openai This endpoint allows you to manage the active sessions of your OpenAI bots. You can change the status of a bot session for a specific contact, for example, to pause or close it. ```APIDOC ## POST /openai/changeStatus/{{instance}} ### Description Manages the status of an OpenAI bot session for a specific contact. ### Method POST ### Endpoint `/openai/changeStatus/{{instance}}` ### Parameters #### Request Body - **contactJid** (string) - Required - The JID of the contact whose session status needs to be changed. - **status** (string) - Required - The new status for the session ('open', 'paused', 'closed'). ### Request Example ```json { "contactJid": "1234567890@s.whatsapp.net", "status": "paused" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message. #### Response Example ```json { "message": "Session status updated successfully" } ``` ``` -------------------------------- ### POST /flowise/settings/{{instance}} Source: https://docs.evolutionfoundation.com.br/evolution-api/integrations/flowise Endpoint to set default configurations for Flowise bots. These settings will be applied if parameters are not provided during bot creation. ```APIDOC ## POST /flowise/settings/{{instance}} ### Description Sets default configurations that will be applied if parameters are not explicitly provided when creating a bot. This allows for consistent bot behavior across multiple instances. ### Method POST ### Endpoint /flowise/settings/{{instance}} ### Parameters #### Request Body - **expire** (integer) - Optional - Default time in minutes after which the bot expires. - **keywordFinish** (string) - Optional - Default keyword that ends the bot session. - **delayMessage** (integer) - Optional - Default delay in milliseconds to simulate typing before sending a message. - **unknownMessage** (string) - Optional - Default message sent when the user's input is not recognized. - **listeningFromMe** (boolean) - Optional - Default setting for whether the bot should listen to messages sent by the user itself. - **stopBotFromMe** (boolean) - Optional - Default setting for whether the bot should stop when the user sends a message. - **keepOpen** (boolean) - Optional - Default setting to keep the session open, preventing the bot from restarting for the same contact. - **debounceTime** (integer) - Optional - Default time in seconds to group multiple messages into one. - **ignoreJids** (array) - Optional - Default list of contact JIDs that will not activate the bot. - **flowiseIdFallback** (string) - Optional - The ID of the fallback bot to be used if no trigger is activated. ### Request Example ```json { "expire": 20, "keywordFinish": "#SAIR", "delayMessage": 1000, "unknownMessage": "Mensagem não reconhecida", "listeningFromMe": false, "stopBotFromMe": false, "keepOpen": false, "debounceTime": 0, "ignoreJids": [], "flowiseIdFallback": "clyja4oys0a3uqpy7k3bd7swe" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message of default settings update. #### Response Example ```json { "message": "Default settings updated successfully" } ``` ```