API WhatsApp Web API WhatsApp Web

Group Management with the API

With this API, you can perform various actions related to WhatsApp groups, such as creating, editing, adding and removing members, as well as setting permissions and efficiently managing groups.

Authentication

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

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

๐Ÿ“Œ Creating WhatsApp Groups via API

๐Ÿ“– Introduction

This API allows you to create new WhatsApp groups through WhatsApp Web JS. To create a group, you need to define a name and add at least one participant.

๐ŸŒ Base URL

Base URL: https://apiwhatsappweb.com/api/create-group

All requests must be made to this base URL.

๐Ÿ”‘ Authentication

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

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

๐Ÿ“Œ How to create a WhatsApp group:

๐Ÿ“œ Request Body

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

{
    "groupName": "Group Name",  
    "participants": ["5511999999999", "5511888888888"]
}

๐Ÿ“Œ Usage Examples

const axios = require("axios");

let data = JSON.stringify({
    "id": "INSTANCE_ID",
    "groupName": "Group Name",
    "participants": ["5511999999999", "5511888888888"]
});

let config = {
    method: 'post',
    url: 'https://apiwhatsappweb.com/api/create-group',
    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));
            

Get Group IDs

Description

This API allows you to retrieve all WhatsApp group IDs from a given active instance by sending a POST request.

Base URL: https://apiwhatsappweb.com/api/get-group-ids

Authentication

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

Request Header

{
        "id": "Your_Instance_ID_Here",
        'apiKey': 'Bearer Your_ApiKey',
}

Usage Example

const axios = require("axios");

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

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

Response

{
        "success": true,
        "message": "Group IDs retrieved successfully!",
        "groupIds": [
            "[email protected]",
            "[email protected]",
            "[email protected]"
        ]
}

Rename Group

Description

This API allows you to rename a WhatsApp group by sending a POST request.

Base URL: https://apiwhatsappweb.com/api/rename-group

Authentication

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

Request Body

{
    "groupId": "[email protected]", 
    "newName": "New Group Name"
}

The GroupId can be obtained from the webhook received.

Usage Example

Attention!

Ensure that you have administrator permissions in the group before renaming it.

const axios = require("axios");

let data = JSON.stringify({
    "groupId": "[email protected]",
    "newName": "New Group Name"
});

let config = {
    method: 'post',
    url: 'https://apiwhatsappweb.com/api/rename-group',
    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

{
    "message": "Group name updated successfully!",
    "groupId": "[email protected]",
    "newName": "New Group Name"
}

API Documentation - Change Group Image

Description

This API allows you to change the image of a WhatsApp group by sending a POST request.

Base URL

Base URL: https://apiwhatsappweb.com/api/change-group-image

Authentication

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

Request Body

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

{
    "groupId": "[email protected]",
    "image": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQE..."
}

Usage Examples

Examples in Node.js and Python:

Response

{
    "message": "Group image updated successfully!",
    "groupId": "[email protected]"
}

Add Contact to Group

API Documentation

This API allows you to add a contact to a WhatsApp group by sending a POST request.

Base URL

Base URL: https://apiwhatsappweb.com/api/add-contact-group

Authentication

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

Request Body

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

{
    "groupId": "[email protected]",
    "contact": "5511998765432"
}

Usage Examples

const axios = require("axios");

let data = JSON.stringify({
    "groupId": "[email protected]",
    "contact": "5511998765432"
});

let config = {
    method: 'post',
    url: 'https://apiwhatsappweb.com/api/add-contact-group',
    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

{
    "message": "Contact added successfully!",
    "groupId": "[email protected]",
    "contact": "5511998765432"
}

Remove Contact from Group

API Documentation

This API allows you to remove a contact from a WhatsApp group by sending a POST request.

Base URL

Base URL: https://apiwhatsappweb.com/api/remove-contact-group

All requests must be made to this base URL.

Authentication

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

Request Body

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

{
    "groupId": "[email protected]",
    "contact": "5511998765432"
}

Usage Examples

Response

{
    "message": "Contact removed successfully!",
    "groupId": "[email protected]",
    "contact": "5511998765432"
}

API Documentation - Approve Contact in Group

Description

This API allows you to approve a contact who requested to join a WhatsApp group by sending a POST request.

Base URL

Base URL: https://apiwhatsappweb.com/api/approve-contact-group

Authentication

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

Request Body

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

{
    "groupId": "[email protected]",
    "contact": "5511998765432"
}
    

Usage Examples

const axios = require("axios");

let data = JSON.stringify({
    "groupId": "[email protected]",
    "contact": "5511998765432"
});

let config = {
    method: 'post',
    url: 'https://apiwhatsappweb.com/api/approve-contact-group',
    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

{
    "message": "Contact approved successfully!",
    "groupId": "[email protected]",
    "contact": "5511998765432"
}
    

๐Ÿ“Œ API Documentation - Reject Contact in Group

This API allows you to reject a contact who requested to join a WhatsApp group.

๐ŸŒ Base URL

Base URL: https://apiwhatsappweb.com/api/reject-contact-group

๐Ÿ”‘ Authentication

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

๐Ÿ“œ Request Body

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

{
    "groupId": "[email protected]",
    "contact": "5511998765432"
}
    

๐Ÿ“Œ Usage Examples

const axios = require("axios");

let data = JSON.stringify({
    "groupId": "[email protected]",
    "contact": "5511998765432"
});

let config = {
    method: 'post',
    url: 'https://apiwhatsappweb.com/api/reject-contact-group',
    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

{
    "message": "Contact rejected successfully!",
    "groupId": "[email protected]",
    "contact": "5511998765432"
}
    

Get Group Contacts

Description

This API allows you to get the list of contacts from a WhatsApp group by sending a GET request.

Base URL: https://apiwhatsappweb.com/api/get-group-contacts

Authentication

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

Request Parameters

The request should include the groupId in the URL, as shown in the example below:

GET /api/[email protected]

Usage Example

Attention!

To access the contacts of a group, you must be a member of the group and have appropriate permissions.

const axios = require("axios");

let config = {
    method: 'get',
    url: 'https://apiwhatsappweb.com/api/[email protected]',
    headers: { 
        'apiKey': 'Bearer Your_ApiKey',
        'id': 'Your_Instance_ID_Here'
    }
};

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

Response

{
    "groupId": "[email protected]",
    "contacts": [
    {
    "id": "[email protected]",
            "name": "John Doe",
            "isAdmin": true
    },
    {
    "id": "[email protected]",
            "name": "Jane Doe",
            "isAdmin": false
    }
    ]
}

API Documentation - Change Group Settings

Description

This API allows you to change settings for a WhatsApp group, such as who can send messages or change group information.

Base URL

Base URL: https://apiwhatsappweb.com/api/alter-group-configs

Authentication

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

Request Body

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

{
    "groupId": "[email protected]",
    "sendMessages": "admins" | "everyone",
    "editGroupInfo": "admins" | "everyone"
}

Usage Examples

Examples in Node.js and Python:

Response

{
    "message": "Group settings updated successfully!",
    "groupId": "[email protected]",
    "sendMessages": "admins",
    "editGroupInfo": "everyone"
}

Change Group Description

API Documentation

This API allows you to change the description of a WhatsApp group by sending a POST request.

Base URL

Base URL: https://apiwhatsappweb.com/api/alter-group-description

Authentication

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

Request Body

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

{
    "groupId": "[email protected]",
    "description": "This is the new group description."
}

Usage Examples

const axios = require("axios");

let data = JSON.stringify({
    "groupId": "[email protected]",
    "description": "This is the new group description."
});

let config = {
    method: 'post',
    url: 'https://apiwhatsappweb.com/api/alter-group-description',
    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

{
    "message": "Group description updated successfully!",
    "groupId": "[email protected]",
    "description": "This is the new group description."
}

API Documentation - Accept Group Invite

Description

This API allows you to accept a WhatsApp group invite by sending a POST request.

Base URL

Base URL: https://apiwhatsappweb.com/api/accept-group-invite

Authentication

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

Request Body

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

{
    "inviteCode": "KJHGFDSERTYUI"
}
    

Usage Examples

const axios = require("axios");

let data = JSON.stringify({
    "inviteCode": "KJHGFDSERTYUI"
});

let config = {
    method: 'post',
    url: 'https://apiwhatsappweb.com/api/accept-group-invite',
    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

{
    "message": "Successfully joined the group!",
    "groupId": "[email protected]"
}
    

๐Ÿ“Œ API Documentation - Set New Admin

This API allows you to promote a member to an admin of a WhatsApp group.

๐ŸŒ Base URL

Base URL: https://apiwhatsappweb.com/api/set-group-admin

๐Ÿ”‘ Authentication

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

๐Ÿ“œ Request Body

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

{
    "groupId": "[email protected]",
    "contact": "5511998765432"
}
    

๐Ÿ“Œ Usage Examples

const axios = require("axios");

let data = JSON.stringify({
    "groupId": "[email protected]",
    "contact": "5511998765432"
});

let config = {
    method: 'post',
    url: 'https://apiwhatsappweb.com/api/set-group-admin',
    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

{
    "message": "Contact promoted to admin successfully!",
    "groupId": "[email protected]",
    "contact": "5511998765432"
}
    

๐Ÿ“Œ API Documentation - Remove Admin

This API allows you to remove an admin from a WhatsApp group.

๐ŸŒ Base URL

Base URL: https://apiwhatsappweb.com/api/remove-group-admin

๐Ÿ”‘ Authentication

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

๐Ÿ“œ Request Body

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

{
    "groupId": "[email protected]",
    "contact": "5511998765432"
}
    

๐Ÿ“Œ Usage Examples

const axios = require("axios");

let data = JSON.stringify({
    "groupId": "[email protected]",
    "contact": "5511998765432"
});

let config = {
    method: 'post',
    url: 'https://apiwhatsappweb.com/api/remove-group-admin',
    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

{
    "message": "Admin rights removed successfully!",
    "groupId": "[email protected]",
    "contact": "5511998765432"
}
    

Mention Group Member

Description

This API allows you to mention a specific member of a WhatsApp group when sending a message.

Base URL: https://apiwhatsappweb.com/api/mention-group-member

Authentication

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

Request Body

{
    "groupId": "[email protected]",
    "contact": "5511998765432",
    "message": "Hello @user, welcome to the group!"
}

Usage Example

Attention!

The mentioned member must be part of the group. Be sure to use the correct number and with the country code.

const axios = require("axios");

let data = JSON.stringify({
    "groupId": "[email protected]",
    "contact": "5511998765432",
    "message": "Hello @user, welcome to the group!"
});

let config = {
    method: 'post',
    url: 'https://apiwhatsappweb.com/api/mention-group-member',
    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

{
    "message": "Mention sent successfully!",
    "groupId": "[email protected]",
    "contact": "5511998765432"
}

API Documentation - Mention All in Group

Description

This API allows you to mention all members of a WhatsApp group when sending a message.

Base URL

Base URL: https://apiwhatsappweb.com/api/mention-group

Authentication

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

Request Body

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

{
    "groupId": "[email protected]",
    "message": "Hello @everyone, this is a message for the whole group!"
}

Usage Examples

Examples in Node.js and Python:

Response

{
    "message": "Group mention sent successfully!",
    "groupId": "[email protected]"
}