API WhatsApp Web API WhatsApp Web

Send Message to WhatsApp

API Documentation

This API allows sending messages to a WhatsApp number via a POST request.

Base URL

Base URL: https://wamessageapi.com/api/text

All requests must be made to this base URL.

Authentication

To authenticate requests, you must include the API Key (apiKey) and the instance ID (identification) in the header.

{
    apiKey: "Your API key here",
    id: "Instance identification here"
}

How to Send Texts

Request Body

The request body must be a JSON object with the following structure:

{
    "number": 5554991997181, // Number to send to
    "message": "Testing message sending." // Message to be sent
}

Usage Examples

const axios = require("axios");

let data = JSON.stringify({
    "message": "Hello, I'm sending you a message",
    "number": "5554991997181"
});

let config = {
    method: 'post',
    url: 'https://wamessageapi.com/api/text',
    headers: { 
        'apiKey': 'Bearer Your_ApiKey',
        'id': 'Your_Instance_ID_Here',
        'Content-Type': 'application/json'
    },
    data: data
};

axios.request(config)
    .then((response) => {
        console.log(JSON.stringify(response.data));
    })
    .catch((error) => {
        console.log(error);
    });

Response

The API will respond with a JSON object confirming success or indicating an error.

Example of a Successful Response:

{
    "message": "Text sent successfully!",
    "phone": 5554991997181,
    "messageId": "unique_message_id"
}

Example of an Error Response:

{
    "error": "Invalid API Key"
}

Status Codes

The API can return the following HTTP status codes:

  • 200 OK: Message sent successfully.
  • 401 Unauthorized: Authentication failed.
  • 500 Internal Server Error: A server error occurred.

Send Image to WhatsApp

API Documentation

This API allows sending images to a WhatsApp number via a POST request.

Base URL

Base URL: https://wamessageapi.com/api/image

All requests must be made to this base URL.

Authentication

To authenticate requests, you must include the API Key (apiKey) and the Instance ID (identification) in the header.

{
    apiKey: "Your API key here",
    id: "Instance identification here"
}

Request Body

The request body must be a JSON object with the following structure:

{
    "image": "Base64Image",
    "number": "555481229802",
    "caption": "Text accompanying the image"
}

Response

The API will respond with a JSON object confirming success or indicating an error.

Example of a Successful Response:

{
    "message": "Image sent successfully!",
    "phone": "Sent number",
    "messageId": "Message ID"
}

Example of an Error Response:

{
    "error": "Error sending image, error.message"
}

Status Codes

The API can return the following HTTP status codes:

  • 200 OK: Image sent successfully!
  • 401 Unauthorized: API Key or ID not provided.
  • 500 Internal Server Error: Error sending the image.

Usage Examples

const axios = require("axios");
const fs = require("fs");

const imageFile = fs.readFileSync("path/to/your/image.jpg").toString("base64");

let data = JSON.stringify({
    "caption": "Check out this image!",
    "number": "5554991997181",
    "image": imageFile
});

let config = {
    method: 'post',
    url: 'https://wamessageapi.com/api/image',
    headers: { 
        'apiKey': 'Bearer Your_ApiKey',
        'id': 'Your_Instance_ID_Here',
        'Content-Type': 'application/json'
    },
    data: data
};

axios.request(config)
    .then(response => console.log(response.data))
    .catch(error => console.error(error));

Send Video

Sending videos is simple: include authentication in the header and attach the video file in the body.

Request Body

{
    "number": "5554991997181", // Enter the recipient's phone number
    "video": videoFile // Video file in the body. Maximum size: 20MB
}

Code Examples

                const axios = require("axios");
                const fs = require("fs");

                const videoFile = fs.readFileSync("path/to/your/video.mp4").toString("base64");

                let data = JSON.stringify({
                    "caption": "",
                    "number": "5554991997181",
                    "video": videoFile
                });

                let config = {
                    method: 'post',
                    url: 'https://wamessageapi.com/api/video',
                    headers: { 
                        'apiKey': 'Bearer Your_ApiKey',
                        'id': 'Your_Instance_ID_Here',
                        'Content-Type': 'application/json'
                    },
                    data: data
                };

                axios.request(config)
                .then((response) => console.log(response.data))
                .catch((error) => console.log(error));
            

Response Examples

Success Example

{
    "message": "Video sent successfully!",
    "phone": "Sent number",
    "messageId": "Message ID" // Can be used to check the message status
}

Error Example

{
    "error": "Error sending video, error.message"
}

Status Codes

  • 200 OK: Video sent successfully!
  • 401 Unauthorized: API Key or ID not provided
  • 500 Internal Server Error: Error sending video

Send Audio

Sending audio is simple! Just include authentication in the header and attach the audio file in the request body in MP3 format.

Request Body

{
    "number": 5554991997181, // Recipient number
    "audio": audioFile // Audio file in the body (base64)
}

Usage Examples

const axios = require("axios");
const fs = require("fs");

const audioFile = fs.readFileSync("path/to/your/audio.mp3").toString("base64");

let data = JSON.stringify({
    "number": "5554991997181",
    "audio": audioFile
});

let config = {
    method: 'post',
    url: 'https://wamessageapi.com/api/audio',
    headers: { 
        'apiKey': 'Bearer Your_ApiKey',
        'id': 'Your_Instance_ID_Here',
        'Content-Type': 'application/json'
    },
    data: data
};

axios.request(config)
    .then(response => console.log(response.data))
    .catch(error => console.error(error));

Response

The API will respond with a JSON object confirming success or indicating an error.

Example of a Successful Response:

{
    "message": "Audio sent successfully!",
    "phone": "5554991997181",
    "messageId": "unique_message_id"
}

Example of an Error Response:

{
    "error": "Error sending audio, error.message"
}

Status Codes

The API may return the following HTTP status codes:

  • 200 OK: Audio sent successfully!
  • 401 Unauthorized: API Key or ID not provided.
  • 500 Internal Server Error: Error sending audio.

Delete WhatsApp Message

API Documentation

This API allows you to delete sent WhatsApp messages through a POST request.

Base URL

Base URL: https://wamessageapi.com/api/delete

All requests must be made to this base URL.

Authentication

To authenticate requests, you must include the API Key (apiKey) and the Instance ID in the header.

{
    "apiKey": "Your API Key here",
    "id": "Instance identification here"
}

How to Delete a Message

Request Body

The request body should be a JSON object with the following structure:

{
    "messageId": "[email protected]_ABCDEF",  // ID of the message to be deleted
    "number": "5511999999999"
}

Code Examples

const axios = require("axios");

let data = JSON.stringify({
    "id": "INSTANCE_ID",
    "messageId": "[email protected]_ABCDEF"
});

let config = {
    method: 'post',
    url: 'https://wamessageapi.com/api/delete',
    headers: { 
        'apiKey': 'Bearer Your_ApiKey',
        'id': 'Your_Instance_ID_Here',
        'Content-Type': 'application/json'
    },
    data: data
};

axios.request(config)
    .then((response) => console.log(response.data))
    .catch((error) => console.log(error));
            

Response Examples

Success Example

{
    "success": true,
    "message": "Message deleted successfully!",
    "messageId": "[email protected]_ABCDEF"
}

Error Example

{
    "error": "Client API disconnected. Please scan the QR code again."
}

Status Codes

  • 200 OK: Message deleted successfully.
  • 401 Unauthorized: Authentication failed.
  • 404 Not Found: Message or chat not found.
  • 500 Internal Server Error: A server error occurred.

Send Documents to WhatsApp

API Documentation

This API allows sending documents (PDF, DOCX, TXT, etc.) to a WhatsApp number through a POST request.

Base URL

Base URL: https://wamessageapi.com/api/document

All requests must be made to this base URL.

Authentication

To authenticate requests, you must include the API Key (apiKey) and the Instance ID (identification) in the header.

{
    "apiKey": "Your API Key here",
    "id": "Your Instance ID here"
}

How to Send a Document:

Request Body

The request body must be a JSON object with the following structure:

{
    "number": "5511999999999",
    "caption": "This is an important document.",
    "document": "BASE64_ENCODED_FILE"
}

Usage Examples

Examples in Node.js, Python, and C++:

Response

The API will respond with a JSON object confirming success or indicating an error.

Example of a Successful Response:

{
    "success": true,
    "message": "Document sent successfully!",
    "messageId": "[email protected]_ABCDEF"
}

Send Reactions to WhatsApp Messages

API Documentation

This API allows sending reactions (emojis) to messages sent on WhatsApp via a POST request.

Base URL

Base URL: https://wamessageapi.com/api/reaction

All requests must be made to this base URL.

Authentication

To authenticate requests, you must include the API Key (apiKey) and the Instance ID (identification) in the header.

{
    "apiKey": "Your API Key here",
    "id": "Your Instance ID here"
}

How to Send a Reaction

Request Body

The request body must be a JSON object with the following structure:

{
    "messageId": "[email protected]_ABCDEF",  // ID of the message that will receive the reaction
    "reaction": "❤️"  // Reaction emoji
}

Usage Examples

const axios = require("axios");

let data = JSON.stringify({
    "id": "INSTANCE_ID",
    "messageId": "[email protected]_ABCDEF",
    "reaction": "🔥"
});

let config = {
    method: 'post',
    url: 'https://wamessageapi.com/api/reaction',
    headers: { 
        'apiKey': 'Bearer Your_ApiKey',
        'id': 'Your_Instance_ID_Here',
        'Content-Type': 'application/json'
    },
    data: data
};

axios.request(config)
    .then((response) => console.log(response.data))
    .catch((error) => console.log(error));

Send Stickers to WhatsApp

API Documentation

This API allows sending stickers to a WhatsApp number through a POST request.

Base URL

Base URL: https://wamessageapi.com/api/sticker

Authentication

Include the API Key (apiKey) and the Instance ID (identification) in the header.

{
    apiKey: Your API Key here
    id: Your Instance ID here
}

How to Send a Sticker:

Request Body

The request body must be a JSON object with the following structure:

{
    "number": "5511999999999",
    "sticker": "BASE64_ENCODED_FILE"
}

Usage Examples

const axios = require("axios");
const fs = require("fs");

const stickerFile = fs.readFileSync("path/to/your/sticker.webp").toString("base64");

let data = JSON.stringify({
    "number": "5511999999999",
    "sticker": stickerFile
});

let config = {
    method: 'post',
    url: 'https://wamessageapi.com/api/sticker',
    headers: { 
        'apiKey': 'Bearer Your_ApiKey',
        'id': 'Your_Instance_ID_Here',
        'Content-Type': 'application/json'
    },
    data: data
};

axios.request(config)
    .then(response => console.log(response.data))
    .catch(error => console.error(error));

Response

The API will respond with a JSON object confirming success or indicating an error.

Example of a Successful Response:

{
    "success": true,
    "message": "Sticker sent successfully!",
    "messageId": "[email protected]_ABCDEF"
}

Send GIFs to WhatsApp

API Documentation

This API allows sending animated GIFs to a WhatsApp number through a POST request.

Base URL

Base URL: https://wamessageapi.com/api/gif

All requests must be made to this base URL.

Authentication

To authenticate requests, you must include the API Key (apiKey) and the Instance ID (identification) in the header.

{
    apiKey: "Your API Key here",
    id: "Your Instance ID here"
}

How to Send a GIF

Request Body

The request body must be a JSON object with the following structure:

{
    "number": "5511999999999",  // Recipient number
    "gif": "BASE64_ENCODED_FILE" // GIF in Base64 or URL
}

Usage Examples

const axios = require("axios");
const fs = require("fs");

const gifFile = fs.readFileSync("path/to/your/animation.gif").toString("base64");

let data = JSON.stringify({
    "id": "INSTANCE_ID",
    "number": "5511999999999",
    "gif": gifFile
});

let config = {
    method: 'post',
    url: 'https://wamessageapi.com/api/gif',
    headers: { 
        'apiKey': 'Bearer Your_ApiKey',
        'id': 'Your_Instance_ID_Here',
        'Content-Type': 'application/json'
    },
    data: data
};

axios.request(config)
    .then(response => console.log(response.data))
    .catch(error => console.error(error));

Response

The API will respond with a JSON object confirming success or indicating an error.

Example of a Successful Response:

{
    "message": "GIF sent successfully!",
    "phone": "5511999999999",
    "messageId": "Message ID"
}

Example of an Error Response:

{
    "error": "Error sending GIF, error.message"
}

Status Codes

The API may return the following HTTP status codes:

  • 200 OK: GIF sent successfully!
  • 401 Unauthorized: API Key or ID not provided.
  • 500 Internal Server Error: Error sending the GIF.

Send Products to WhatsApp

API Documentation

This API allows sending product information to a WhatsApp number via a POST request.

Base URL

Base URL: https://wamessageapi.com/api/product

All requests must be made to this base URL.

Authentication

To authenticate requests, you must include the API Key (apiKey) and the Instance ID (identification) in the header.

{
    "apiKey": "Your API Key here",
    "id": "Your Instance ID here"
}

How to Send a Product:

Request Body

The request body must be a JSON object with the following structure:

{
    "number": "5511999999999",
    "title": "Example Product",
    "description": "Detailed product description.",
    "price": "$99.90",
    "image": "https://mywebsite.com/product.jpg",
    "link": "https://mywebsite.com/product"
}

Usage Examples

Examples in Node.js, Python, and C:

Response

The API will respond with a JSON object confirming success or indicating an error.

Example of a Successful Response:

{
    "success": true,
    "message": "Product sent successfully!",
    "messageId": "[email protected]_ABCDEF"
}

Send Catalog to WhatsApp

API Documentation

This API allows sending a product catalog to a WhatsApp number via a POST request.

Base URL

Base URL: https://wamessageapi.com/api/catalog

All requests must be made to this base URL.

Authentication

To authenticate requests, you must include the API Key (apiKey) and the Instance ID (identification) in the header.

{
    "apiKey": "Your API Key here",
    "id": "Your Instance ID here"
}

How to Send a Catalog

Request Body

The request body must be a JSON object with the following structure:

{
    "number": "5511999999999",
    "catalog": [
        {
            "title": "Product 1",
            "description": "Description of product 1.",
            "price": "$49.90",
            "image": "https://mywebsite.com/product1.jpg",
            "link": "https://mywebsite.com/product1"
        },
        {
            "title": "Product 2",
            "description": "Description of product 2.",
            "price": "$99.90",
            "image": "https://mywebsite.com/product2.jpg",
            "link": "https://mywebsite.com/product2"
        }
    ]
}

Usage Examples

const axios = require("axios");

let data = JSON.stringify({
    "id": "INSTANCE_ID",
    "number": "5511999999999",
    "catalog": [{
        "title": "Product 1",
        "description": "Description of product 1.",
        "price": "$49.90",
        "image": "https://mywebsite.com/product1.jpg",
        "link": "https://mywebsite.com/product1"
    }]
});

let config = {
    method: 'post',
    url: 'https://wamessageapi.com/api/catalog',
    headers: { 
        'apiKey': 'Bearer Your_ApiKey',
        'id': 'Your_Instance_ID_Here',
        'Content-Type': 'application/json'
    },
    data: data
};

axios.request(config)
    .then((response) => console.log(response.data))
    .catch((error) => console.log(error));

Send Contact to WhatsApp

API Documentation

This API allows sending contact information to a WhatsApp number via a POST request.

Base URL

Base URL: https://wamessageapi.com/api/contact

All requests must be made to this base URL.

Authentication

To authenticate requests, you must include the API Key (apiKey) and the Instance ID (identification) in the header.

{
    apiKey: "Your API key here",
    id: "Your instance ID here"
}

How to Send a Contact

Request Body

The request body should be a JSON object with the following structure:

{
    "number": "5511999999999",  // Recipient's number
    "contactName": "John Doe",  // Contact's name
    "contactNumber": "5511987654321",  // Contact's phone number
    "message": "Here is the contact you requested."  // (Optional) Additional message
}

Usage Examples

const axios = require("axios");

let data = JSON.stringify({
    "id": "INSTANCE_ID",
    "number": "5511999999999",
    "contactName": "John Doe",
    "contactNumber": "5511987654321",
    "message": "Here is the contact you requested."
});

let config = {
    method: 'post',
    url: 'https://wamessageapi.com/api/contact',
    headers: { 
        'apiKey': 'Bearer Your_ApiKey',
        'id': 'Your_Instance_ID_Here',
        'Content-Type': 'application/json'
    },
    data: data
};

axios.request(config)
    .then(response => console.log(response.data))
    .catch(error => console.error(error));

Response

The API will respond with a JSON object containing confirmation or an error message.

Example of a Successful Response:

{
    "message": "Contact sent successfully!",
    "phone": "5511999999999",
    "messageId": "Message ID"
}

Example of an Error Response:

{
    "error": "Error sending contact, error.message"
}

Status Codes

The API may return the following HTTP status codes:

  • 200 OK: Contact sent successfully!
  • 401 Unauthorized: API Key or Instance ID not provided.
  • 500 Internal Server Error: Error sending contact.

Enviar Enquete para o WhatsApp

Documentação da API

Esta API permite o envio de enquetes para um número do WhatsApp via uma requisição POST.

URL Base

URL Base: https://wamessageapi.com/api/poll

Todas as requisições devem ser feitas para esta URL base.

Autenticação

Para autenticar as requisições, inclua a Chave da API (apiKey) e o ID da Instância (identification) no cabeçalho da requisição.

{
    "apiKey": "Sua chave da API aqui",
    "id": "Seu ID da instância aqui"
}

Como Enviar uma Enquete

Corpo da Requisição

O corpo da requisição deve ser um objeto JSON com a seguinte estrutura:

{
    "number": "5511999999999",
    "question": "Qual é a sua cor favorita?",
    "options": ["Azul", "Verde", "Vermelho", "Amarelo"]
}

Exemplos de Uso

Send Message with Buttons to WhatsApp

API Documentation

This API allows sending interactive messages with buttons to a WhatsApp number via a POST request.

Base URL

Base URL: https://wamessageapi.com/api/button

All requests must be made to this base URL.

Authentication

To authenticate the requests, include the API Key (apiKey) and the Instance ID (id) in the request header.

{
    "apiKey": "Your API key here",
    "id": "Your instance ID here"
}
    

How to Send a Message with Buttons

Request Body

The request body should be a JSON object with the following structure:

{
    "number": "5511999999999",
    "body": "Choose an option:",
    "buttons": [
        { "id": "btn1", "text": "Option 1" },
        { "id": "btn2", "text": "Option 2" },
        { "id": "btn3", "text": "Option 3" }
    ]
}
    

Usage Examples

const axios = require("axios");

let data = JSON.stringify({
    "id": "INSTANCE_ID",
    "number": "5511999999999",
    "body": "Choose an option:",
    "buttons": [
        { "id": "btn1", "text": "Option 1" },
        { "id": "btn2", "text": "Option 2" },
        { "id": "btn3", "text": "Option 3" }
    ]
});

let config = {
    method: 'post',
    url: 'https://wamessageapi.com/api/button',
    headers: { 
        'apiKey': 'Bearer Your_ApiKey',
        'id': 'Your_Instance_ID_Here',
        'Content-Type': 'application/json'
    },
    data: data
};

axios.request(config)
    .then((response) => console.log(response.data))
    .catch((error) => console.log(error));

Send Event to WhatsApp

API Documentation

This API allows sending custom events to a WhatsApp number via a POST request.

Base URL

Base URL: https://wamessageapi.com/api/event

All requests must be made to this base URL.

Authentication

To authenticate the requests, you must include the API Key (apiKey) and the instance ID ID in the request header.

{
    "apiKey": "Your API key here",
    "id": "Your instance ID here"
}

How to Send an Event

Request Body

The request body should be a JSON object with the following structure:

{
    "number": "5511999999999",  // Recipient's phone number
    "eventType": "promo",  // Event type (e.g., "promo", "reminder", "update")
    "message": "Special promotion! 30% off for the first 100 customers."  // Event message
}

Code Examples

const axios = require("axios");

let data = JSON.stringify({
    "id": "INSTANCE_ID",
    "number": "5511999999999",
    "eventType": "promo",
    "message": "Special promotion! 30% off for the first 100 customers."
});

let config = {
    method: 'post',
    url: 'https://wamessageapi.com/api/event',
    headers: { 
        'apiKey': 'Bearer Your_ApiKey',
        'id': 'Your_Instance_ID_Here',
        'Content-Type': 'application/json'
    },
    data: data
};

axios.request(config)
    .then((response) => console.log(response.data))
    .catch((error) => console.log(error));
            

Response Examples

Success Example

{
    "success": true,
    "message": "Event sent successfully!",
    "eventId": "1234567890"
}

Error Example

{
    "error": "Invalid phone number."
}

Status Codes

  • 200 OK: Event sent successfully.
  • 401 Unauthorized: Authentication failure.
  • 404 Not Found: Phone number not found.
  • 500 Internal Server Error: A server error occurred.

Responding to Events via WhatsApp

API Documentation

This API allows responding to previously sent events to a WhatsApp number via a POST request.

Base URL

Base URL: https://wamessageapi.com/api/event-response

All requests must be made to this base URL.

Authentication

To authenticate the requests, you must include the API Key (apiKey) and the instance ID Id (identification) in the request header.

{
    "apiKey": "Your API key here",
    "id": "Your instance ID here"
}

How to Respond to an Event:

Request Body

The request body should be a JSON object with the following structure:

{   
    "messageId": "1234567890",
    "responseText": "Thank you for the promotion!",
    "sender": "5511999999999"
}

Usage Examples

Examples in Node.js, Python, and C:

Response

The API will respond with a JSON object containing either a confirmation or an error message.

Success Response Example:

{
    "success": true,
    "message": "Response sent successfully!",
    "messageId": "[email protected]_ABCDEF"
}

Pin Message on WhatsApp

API Documentation

This API allows pinning messages in a WhatsApp chat via a POST request.

Base URL

Base URL: https://wamessageapi.com/api/fixate

All requests must be made to this base URL.

Authentication

To authenticate the requests, you must include the API Key (apiKey) and the instance ID Id (identification) in the request header.

{
    "apiKey": "Your API key here",
    "id": "Your instance ID here"
}

How to Pin a Message

Request Body

The request body should be a JSON object with the following structure:

{
    "messageId": "1234567890",
    "chatId": "[email protected]"
}

Usage Examples

const axios = require("axios");

let data = JSON.stringify({
    "id": "INSTANCE_ID",
    "messageId": "1234567890",
    "chatId": "[email protected]"
});

let config = {
    method: 'post',
    url: 'https://wamessageapi.com/api/fixate',
    headers: { 
        'apiKey': 'Bearer Your_ApiKey',
        'id': 'Your_Instance_ID_Here',
        'Content-Type': 'application/json'
    },
    data: data
};

axios.request(config)
    .then((response) => console.log(response.data))
    .catch((error) => console.log(error));

Send Location to WhatsApp

API Documentation

This API allows sending a location to a WhatsApp number via a POST request.

Base URL

Base URL: https://wamessageapi.com/api/location

All requests must be made to this base URL.

Authentication

To authenticate the requests, include the API Key (apiKey) and the instance ID Id (identification) in the request header.

{
    "apiKey": "Your API key here",
    "id": "Your instance ID here"
}

How to Send a Location

Request Body

The request body should be a JSON object with the following structure:

{
    "number": "5511999999999",
    "latitude": "-23.550520",
    "longitude": "-46.633308",
    "address": "Avenida Paulista, São Paulo, Brasil"
}

Usage Examples