Introduction
The wapiflow 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 wapiflow 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://wapiflow.cloud/external-api
Authentication
All requests to the wapiflow 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 wapiflow Dashboard under Developer Tools.
In addition to credentials, wapiflow 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 wapiflow 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
}
}
Ejemplo de respuesta 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://wapiflow.cloud/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 wapiflow account.
Parámetros de consulta
Parámetros para personalizar la respuesta de la API.
| Nombre | Descripción | Requerido | Predeterminado |
|---|---|---|---|
página |
Especifica el número de página a recuperar. | No | 1 |
paginar |
Define el número de elementos por página. | No | 20 |
buscar |
Busca por nombre, apellido o número móvil. | No | - |
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://wapiflow.cloud/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 wapiflow 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 requeridos
Los siguientes campos son necesarios para crear un contacto.
| Nombre | Requerido | Predeterminado |
|---|---|---|
nombre |
Sí | - |
apellido |
Sí | - |
código_móvil |
Sí | - |
móvil |
Sí | - |
ciudad |
No | - |
estado |
No | - |
código_postal |
No | - |
dirección |
No | - |
imagen_perfil |
No | - |
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://wapiflow.cloud/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 permite actualizar campos específicos de un contacto.
Campos requeridos
Los siguientes campos son necesarios para crear un contacto.
| Nombre | Requerido | Predeterminado |
|---|---|---|
nombre |
Sí | - |
apellido |
Sí | - |
código_móvil |
Sí | - |
móvil |
Sí | - |
ciudad |
No | - |
estado |
No | - |
código_postal |
No | - |
dirección |
No | - |
imagen_perfil |
No | - |
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://wapiflow.cloud/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 endpoint permite eliminar un contacto por su ID.
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://wapiflow.cloud/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
Obtenga la lista paginada de sus conversaciones.
Parámetros de consulta
| Nombre | Descripción | Predeterminado |
|---|---|---|
status |
Filtre por estado usando los valores indicados. Done = 1; Pending = 2; Important = 3; Unread = 4; | Todo |
página |
Especifica el número de página a recuperar. | 1 |
paginar |
Define el número de elementos por página. | 20 |
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://wapiflow.cloud/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 estado de conversación
Actualice el estado: Terminado=1, Pendiente=2, Importante=3, No leído=4
Parámetros URL
| Parámetro | Tipo | Descripción |
|---|---|---|
conversation_id |
integer | ID ú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://wapiflow.cloud/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
Recupere detalles como notas, etiquetas y asociaciones.
Parámetros URL
| Parámetro | Tipo | Descripción |
|---|---|---|
conversation_id |
integer | ID único de la conversación |
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://wapiflow.cloud/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íe mensajes de WhatsApp. Si el contacto no existe, se creará automáticamente.
Cuerpo de la solicitud
| Campo | Tipo | Requerido | Descripción |
|---|---|---|---|
mobile_code |
string | yes | Código de país. Debe ser numérico y sin el signo (+). |
mobile |
string | yes | Un número móvil válido asociado al código de país. |
from_number |
string | conditional | Se requiere un ID de cuenta de WhatsApp Business. Si no se provee, se usará el predeterminado. |
message |
string | Conditional | Cuerpo del mensaje. Requerido si no hay archivos multimedia. |
image |
file | No | Imagen (jpg, jpeg, png - máx 5MB) |
document |
file | No | Documento (pdf, doc, docx - máx 100MB) |
video |
file | No | Vídeo (mp4 - máx 16MB) |
audio |
file | No | Audio - máx 16MB |
latitude |
decimal | Conditional | Latitud para mensaje de ubicación |
longitude |
decimal | Conditional | Longitud para mensaje de ubicación |
cta_url_id |
integer | No | ID de URL de CTA para botones interactivos |
interactive_list_id |
integer | No | ID de lista interactiva |
Notas
Debe proveerse 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://wapiflow.cloud/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íe plantillas aprobadas por Meta.
Cuerpo de la solicitud
| Campo | Tipo | Requerido | Descripción |
|---|---|---|---|
mobile_code |
string | yes | Código de país. Debe ser numérico y sin el signo (+). |
mobile |
string | yes | Un número móvil válido asociado al código de país. |
from_number |
string | conditional | Se requiere un ID de cuenta de WhatsApp Business. Si no se provee, se usará el predeterminado. |
template_id |
integer | Yes | ID de plantilla aprobada de WhatsApp |
Notas
Solo se pueden enviar plantillas aprobadas.
Las plantillas se usan para conversaciones iniciadas por la empresa.
Los bloqueados no pueden recibir plantillas.
La cuenta de WhatsApp debe estar conectada.
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://wapiflow.cloud/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
Obtenga todas las plantillas asociadas a su cuenta.