Introduction
The AgenteWasap API follows RESTful architecture standards, offering clear and consistent resource-based endpoints. All requests and responses are transmitted in JSON format, leveraging standard HTTP verbs, status codes, and authentication protocols to enable secure, efficient, and scalable integrations.
API Base URL
Please note that AgenteWasap does not provide a sandbox or test environment. All API requests are processed in the live environment, so ensure that all request data and parameters are accurate before making any calls.
https://agentewasap.com/external-api
Authentication
All requests to the AgenteWasap API require authentication. Each API request must include a valid client-id and client-secret to the request header, which can be obtained from your AgenteWasap Dashboard under Developer Tools.
In addition to credentials, AgenteWasap enforces IP-based security. You must register and enable your server’s public IP address in the IP Whitelist section of the dashboard. Requests originating from non-whitelisted IP addresses will be automatically rejected.
Both valid API credentials and an approved IP address are mandatory. Without completing these two steps, authentication will fail and API access will not be granted.
Response Format
All responses from the AgenteWasap API are returned in JSON format. Each response follows a consistent structure and includes a status indicator, message, and relevant data payload when applicable. Standard HTTP status codes are used to represent the outcome of each request.
Ejemplo de respuesta exitosa
{
"status": "success",
"remark": "contact_list",
"message":[
"Contact list fetched successfully"
],
"data": {
...you get all data here
}
}
Respuesta de muestra de error
{
"remark": "Unauthorized",
"status": "error",
"message": [
"The client secret is required"
]
}
{
"remark": "Unauthorized",
"status": "error",
"message": [
"Access to this API endpoint is restricted to IP addresses that have been explicitly whitelisted.",
"In order to access this API endpoint, please add your IP address (::1) to the white list from the user dashboard."
]
}
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://agentewasap.com/extern-api/contact/list',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'client-id: YOUR-CLIENT-ID',
'client-secret: YOUR-CLIENT-SECRET',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Get Contact List
This endpoint allows you to retrieve a complete list of contacts associated with your AgenteWasap account.
Parámetros de consulta
Parámetros de consulta que permiten personalizar la respuesta de la API.
| Nombre | Descripción | Requerido | Por defecto |
|---|---|---|---|
página |
Especifica el número de página que se desea recuperar. | No | 1 |
paginar |
Define el número de elementos que se devuelven por página. | No | 20 |
buscar |
Busca contactos por nombre, apellido o número de teléfono móvil. | No | - |
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://agentewasap.com/extern-api/contact/store',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('firstname' => 'John','lastname' => 'Doe','mobile_code' => '880','mobile' => '01988'),
CURLOPT_HTTPHEADER => array(
'client-id: YOUR-CLIENT-ID',
'client-secret: YOUR-CLIENT-SECRET',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Crear nuevo contacto
This endpoint allows you to add a new contact to your AgenteWasap account. Provide the necessary contact details, and upon successful request, the API returns the created contact’s information in JSON format for easy integration.
Campos obligatorios
Los siguientes campos son obligatorios para crear un nuevo contacto en el sistema.
| Nombre | Requerido | Por defecto |
|---|---|---|
nombre de pila |
Sí | - |
apellido |
Sí | - |
código móvil |
Sí | - |
móvil |
Sí | - |
ciudad |
No | - |
estado |
No | - |
código postal |
No | - |
DIRECCIÓN |
No | - |
imagen_de_perfil |
No | - |
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://agentewasap.com/extern-api/contact/update/{contactId}',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('firstname' => 'John','lastname' => 'Doe','mobile_code' => '880','mobile' => '01988'),
CURLOPT_HTTPHEADER => array(
'client-id: YOUR-CLIENT-ID',
'client-secret: YOUR-CLIENT-SECRET',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Actualizar contacto
Este endpoint te permite actualizar un contacto existente. Solo necesitas enviar los campos que deseas modificar. Cualquier campo que no se incluya en la solicitud permanecerá sin cambios.
Campos obligatorios
Los siguientes campos son obligatorios para crear un nuevo contacto en el sistema.
| Nombre | Requerido | Por defecto |
|---|---|---|
nombre de pila |
Sí | - |
apellido |
Sí | - |
código móvil |
Sí | - |
móvil |
Sí | - |
ciudad |
No | - |
estado |
No | - |
código postal |
No | - |
DIRECCIÓN |
No | - |
imagen_de_perfil |
No | - |
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://agentewasap.com/extern-api/contact/delete/{contactId}',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_POSTFIELDS => array('firstname' => 'John','lastname' => 'Doe','mobile_code' => '880','mobile' => '01988'),
CURLOPT_HTTPHEADER => array(
'client-id: YOUR-CLIENT-ID',
'client-secret: YOUR-CLIENT-SECRET',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Eliminar contacto
Este punto final permite eliminar un contacto mediante su ID único. La eliminación puede estar restringida si el contacto tiene mensajes asociados o está bloqueado.
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://agentewasap.com/extern-api/inbox/conversation-list',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'client-id: YOUR-CLIENT-ID',
'client-secret: YOUR-CLIENT-SECRET',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Lista de conversaciones
Recupera una lista paginada de conversaciones del usuario autenticado, incluyendo información de contacto y estado de la conversación.
Parámetros de consulta
| Nombre | Descripción | Por defecto |
|---|---|---|
status |
Filtra las conversaciones por estado. Utiliza el siguiente valor para filtrar las conversaciones por estado. Done = 1; Pending = 2; Important = 3; Unread = 4; | Todo |
página |
Especifica el número de página que se desea recuperar. | 1 |
paginar |
Define el número de elementos que se devuelven por página. | 20 |
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://agentewasap.com/extern-api/inbox/change-conversation-status/2',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('status' => '1'),
CURLOPT_HTTPHEADER => array(
'client-id: YOUR-CLIENT-ID',
'client-secret: YOUR-CLIENT-SECRET',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Cambiar el estado de la conversación
Actualiza el estado de una conversación, como pendiente, finalizada o importante. Aquí, Finalizada = 1, Pendiente = 2, Importante = 3, No leída = 4
Parámetros de URL
| Parámetro | Tipo | Descripción |
|---|---|---|
conversation_id |
integer | Identificador único de la conversación |
Cuerpo de la solicitud
| Campo | Tipo | Requerido |
|---|---|---|
status |
integer | YEs |
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://agentewasap.com/extern-api/inbox/conversation-details/2',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_POSTFIELDS => array('status' => '1'),
CURLOPT_HTTPHEADER => array(
'client-id: YOUR-CLIENT-ID',
'client-secret: YOUR-CLIENT-SECRET',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Detalles de la conversación
Recupera todos los detalles de una conversación, incluyendo información de contacto, notas, etiquetas y asociaciones de listas.
Parámetros de URL
| Parámetro | Tipo | Descripción |
|---|---|---|
conversation_id |
integer | Identificador único de la conversación |
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://agentewasap.com/extern-api/inbox/send-message',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('mobile_code' => '880','mobile' => xxxxxxxxx','message' => 'Hello world'),
CURLOPT_HTTPHEADER => array(
'client-id: YOUR-CLIENT-ID',
'client-secret: YOUR-CLIENT-SECRET',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Enviar mensaje
Envía mensajes de WhatsApp a un número de móvil. Este endpoint admite texto, contenido multimedia, ubicación, listas interactivas, URL de llamada a la acción y mensajes de comercio electrónico. Si no se encuentra ningún contacto o conversación asociada al número de teléfono proporcionado, se creará automáticamente uno nuevo.
Cuerpo de la solicitud
| Campo | Tipo | Requerido | Descripción |
|---|---|---|---|
mobile_code |
string | yes | Código de país para dispositivos móviles. Debe ser un código de país numérico válido sin el signo más (+). |
mobile |
string | yes | Un número de teléfono móvil válido asociado al código de país proporcionado. |
from_number |
string | conditional | Se requiere un número de teléfono válido de WhatsApp Business registrado en tu cuenta y en el panel de control de Meta. Si no proporcionas ningún ID, el mensaje se enviará utilizando tu cuenta de WhatsApp predeterminada. |
message |
string | Conditional | Cuerpo del mensaje de texto. Obligatorio si no se proporciona ningún dato multimedia, de ubicación o interactivo. |
image |
file | No | Archivo de imagen (jpg, jpeg, png – máximo 5 MB) |
document |
file | No | Archivo de documento (pdf, doc, docx – máximo 100 MB) |
video |
file | No | Archivo de vídeo (mp4 – máximo 16 MB) |
audio |
file | No | Archivo de audio – máximo 16 MB |
latitude |
decimal | Conditional | Latitud para el mensaje de ubicación |
longitude |
decimal | Conditional | Longitud para mensaje de ubicación |
cta_url_id |
integer | No | ID de URL de CTA para mensajes de botones interactivos |
interactive_list_id |
integer | No | ID de lista interactiva |
Notas
Se debe proporcionar al menos un tipo de mensaje.
Los mensajes interactivos requieren un plan activo.
Los contactos bloqueados no pueden enviar ni recibir mensajes.
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://agentewasap.com/extern-api/inbox/send-template-message',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('mobile_code' => '880','mobile' => 'xxxxxx','testmplate_id' => 'your template id'),
CURLOPT_HTTPHEADER => array(
'client-id: YOUR-CLIENT-ID',
'client-secret: YOUR-CLIENT-SECRET',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Enviar mensaje de plantilla
Envía un mensaje de plantilla de WhatsApp aprobado a una conversación existente. Los mensajes de plantilla se utilizan habitualmente para notificaciones, alertas y comunicaciones empresariales.
Cuerpo de la solicitud
| Campo | Tipo | Requerido | Descripción |
|---|---|---|---|
mobile_code |
string | yes | Código de país para dispositivos móviles. Debe ser un código de país numérico válido sin el signo más (+). |
mobile |
string | yes | Un número de teléfono móvil válido asociado al código de país proporcionado. |
from_number |
string | conditional | Se requiere un número de teléfono válido de WhatsApp Business registrado en tu cuenta y en el panel de control de Meta. Si no proporcionas ningún ID, el mensaje se enviará utilizando tu cuenta de WhatsApp predeterminada. |
template_id |
integer | Yes | ID de plantilla de WhatsApp aprobada |
Notas
Solo se pueden enviar plantillas de WhatsApp aprobadas.
Los mensajes predefinidos se utilizan normalmente para conversaciones iniciadas por la empresa.
Los contactos bloqueados no pueden recibir mensajes de plantilla.
Para enviar mensajes, debe conectar su cuenta de WhatsApp.
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://agentewasap.com/extern-api/inbox/template-list',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'client-id: YOUR-CLIENT-ID',
'client-secret: YOUR-CLIENT-SECRET',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Obtener lista de plantillas
Este punto final te permite obtener todas las plantillas de WhatsApp asociadas a tu cuenta.