MENU navbar-image

Introducción

Este API contiene la lógica de negocio que se encarga de alimentar el sistema de Atención Profesional de Cyberfuel S.A. Los usuarios de consumo no deberán ser de uso compartido y deberá mantenerse una segmentación en su uso, único y exclusivo para el fin que fueron brindados.

Este API contiene la lógica de negocio que se encarga de alimentar el sistema de Atención Profesional de Cyberfuel S.A. 

Los usuarios de consumo no deberán ser de uso compartido y deberá mantenerse una segmentación en su uso, único y exclusivo para el fin que fueron brindados. 

El acceso no autorizado a este API es prohibido. 

Autenticación de Solicitudes

Para autenticar sus solicitudes, incluya los siguientes headers con las credenciales asignadas al proyecto o desarrollador: X-User-Consumo y X-User-Secret.

Todos los endpoints autenticados están marcados con una insignia de requiere autenticación en la documentación.

Si requiere acceso desde otro proyecto distinto al API de Atención Profesional, favor solicitar un nuevo acceso vía correo electrónico al mail: dnunez@cyberfuel.com

Broadcast

Enviar mensaje publico

requires authentication

Publica un mensaje en un canal publico.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/broadcast/public-message';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Authorization' => 'string required Bearer token (auth:sanctum).',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'chatId' => '"chat-123"',
            'message' => '"Hola a todos"',
            'channel' => '"general"',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/broadcast/public-message"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Authorization": "string required Bearer token (auth:sanctum).",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "chatId": "\"chat-123\"",
    "message": "\"Hola a todos\"",
    "channel": "\"general\""
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "status": "success",
    "message": "Public message sent",
    "data": {
        "channel": "publicchat.general",
        "event": "MessageSent",
        "payload": {
            "chatId": "chat-123",
            "message": "Hola a todos",
            "user": "John Doe"
        }
    }
}
 

Example response (422):


{
    "message": "The message field is required."
}
 

Request   

POST api/broadcast/public-message

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Authorization        

Example: string required Bearer token (auth:sanctum).

Content-Type        

Example: application/json

Body Parameters

chatId   string  optional    

Chat opcional para referencia. Example: "chat-123"

message   string     

Mensaje a enviar (max 500). Example: "Hola a todos"

channel   string     

Canal publico de destino. Example: "general"

Enviar notificacion privada a usuario

requires authentication

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/broadcast/private-notification';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Authorization' => 'string required Bearer token (auth:sanctum).',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'chatId' => '"chat-123"',
            'user_id' => 7,
            'title' => '"Aviso"',
            'message' => '"Tienes un nuevo mensaje"',
            'type' => '"info"',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/broadcast/private-notification"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Authorization": "string required Bearer token (auth:sanctum).",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "chatId": "\"chat-123\"",
    "user_id": 7,
    "title": "\"Aviso\"",
    "message": "\"Tienes un nuevo mensaje\"",
    "type": "\"info\""
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "status": "success",
    "message": "Private notification sent",
    "data": {
        "channel": "privateuser.7",
        "event": "UserNotification",
        "payload": {
            "title": "Aviso",
            "message": "Tienes un nuevo mensaje"
        }
    }
}
 

Request   

POST api/broadcast/private-notification

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Authorization        

Example: string required Bearer token (auth:sanctum).

Content-Type        

Example: application/json

Body Parameters

chatId   string  optional    

Chat opcional para referencia. Example: "chat-123"

user_id   integer     

Id del usuario destino. Example: 7

title   string     

Titulo de la notificacion (max 100). Example: "Aviso"

message   string     

Mensaje (max 500). Example: "Tienes un nuevo mensaje"

type   string  optional    

Tipo de notificacion: info,warning,error,success. Example: "info"

Obtener canales y eventos disponibles

requires authentication

Lista canales/eventos ejemplo para broadcast.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/broadcast/channels-info';
$response = $client->get(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Authorization' => 'string required Bearer token (auth:sanctum).',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/broadcast/channels-info"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Authorization": "string required Bearer token (auth:sanctum).",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "channels": {
        "public": [
            "publicchat.general",
            "publicchat.support",
            "public.notifications"
        ],
        "private": [
            "privateuser.{userId}",
            "privateclient.{clientId}"
        ],
        "presence": [
            "presencechat.{roomId}",
            "presencesupport.{sessionId}"
        ]
    },
    "events": [
        "MessageSent",
        "UserNotification",
        "ClientMessage",
        "UserStatusChanged"
    ]
}
 

Request   

GET api/broadcast/channels-info

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Authorization        

Example: string required Bearer token (auth:sanctum).

Enviar mensaje a canal de presencia (usuarios)

requires authentication

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/broadcast/sendPresenceChannel';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Authorization' => 'string required Bearer token (auth:sanctum).',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'chatId' => '"chat-123"',
            'message' => '"Hola a la sala"',
            'room_id' => '"room-1"',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/broadcast/sendPresenceChannel"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Authorization": "string required Bearer token (auth:sanctum).",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "chatId": "\"chat-123\"",
    "message": "\"Hola a la sala\"",
    "room_id": "\"room-1\""
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "status": "success",
    "message": "Mensaje enviado"
}
 

Request   

POST api/broadcast/sendPresenceChannel

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Authorization        

Example: string required Bearer token (auth:sanctum).

Content-Type        

Example: application/json

Body Parameters

chatId   string  optional    

Chat opcional para referencia. Example: "chat-123"

message   string     

Mensaje a enviar (max 1000). Example: "Hola a la sala"

room_id   string     

Identificador del room de presencia. Example: "room-1"

Indicador de escribiendo en canal de presencia (usuarios)

requires authentication

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/broadcast/userPresenceChannelTyping';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Authorization' => 'string required Bearer token (auth:sanctum).',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'room_id' => '"room-1"',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/broadcast/userPresenceChannelTyping"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Authorization": "string required Bearer token (auth:sanctum).",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "room_id": "\"room-1\""
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "status": "success"
}
 

Request   

POST api/broadcast/userPresenceChannelTyping

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Authorization        

Example: string required Bearer token (auth:sanctum).

Content-Type        

Example: application/json

Body Parameters

room_id   string     

Identificador del room de presencia. Example: "room-1"

Enviar mensaje publico a clientes

requires authentication

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/broadcast/publicCustomer-message';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Authorization' => 'string required Bearer token (auth:sanctum).',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'chatId' => '"chat-123"',
            'customer' => '"cust-55"',
            'message' => '"Hola cliente"',
            'channel' => '"public.customer"',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/broadcast/publicCustomer-message"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Authorization": "string required Bearer token (auth:sanctum).",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "chatId": "\"chat-123\"",
    "customer": "\"cust-55\"",
    "message": "\"Hola cliente\"",
    "channel": "\"public.customer\""
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "status": "success",
    "message": "Public message sent",
    "data": {
        "channel": "public.customer",
        "event": "MessageSent",
        "payload": {
            "customer": "cust-55",
            "message": "Hola cliente"
        }
    }
}
 

Request   

POST api/broadcast/publicCustomer-message

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Authorization        

Example: string required Bearer token (auth:sanctum).

Content-Type        

Example: application/json

Body Parameters

chatId   string  optional    

Chat opcional para referencia. Example: "chat-123"

customer   string     

Identificador del cliente. Example: "cust-55"

message   string     

Mensaje (max 500). Example: "Hola cliente"

channel   string     

Canal publico para clientes. Example: "public.customer"

Enviar notificacion privada a cliente

requires authentication

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/broadcast/privateCustomer-notification';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Authorization' => 'string required Bearer token (auth:sanctum).',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'chatId' => '"chat-123"',
            'customer_id' => 9,
            'user_id' => 7,
            'title' => '"Aviso"',
            'message' => '"Tienes un nuevo mensaje"',
            'type' => '"info"',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/broadcast/privateCustomer-notification"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Authorization": "string required Bearer token (auth:sanctum).",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "chatId": "\"chat-123\"",
    "customer_id": 9,
    "user_id": 7,
    "title": "\"Aviso\"",
    "message": "\"Tienes un nuevo mensaje\"",
    "type": "\"info\""
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "status": "success",
    "message": "Private notification sent",
    "data": {
        "channel": "client.9.7",
        "event": "UserNotification",
        "payload": {
            "title": "Aviso",
            "message": "Tienes un nuevo mensaje"
        }
    }
}
 

Request   

POST api/broadcast/privateCustomer-notification

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Authorization        

Example: string required Bearer token (auth:sanctum).

Content-Type        

Example: application/json

Body Parameters

chatId   string  optional    

Chat opcional para referencia. Example: "chat-123"

customer_id   integer     

Id del cliente. Example: 9

user_id   integer     

Id del usuario destino. Example: 7

title   string     

Titulo (max 100). Example: "Aviso"

message   string     

Mensaje (max 500). Example: "Tienes un nuevo mensaje"

type   string  optional    

Tipo de notificacion: info,warning,error,success. Example: "info"

Enviar mensaje a canal de presencia de cliente

requires authentication

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/broadcast/sendCustomerPresenceChannel';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Authorization' => 'string required Bearer token (auth:sanctum).',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'chatId' => '"chat-123"',
            'customerId' => 9,
            'message' => '"Hola cliente"',
            'room_id' => '"room-1"',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/broadcast/sendCustomerPresenceChannel"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Authorization": "string required Bearer token (auth:sanctum).",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "chatId": "\"chat-123\"",
    "customerId": 9,
    "message": "\"Hola cliente\"",
    "room_id": "\"room-1\""
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "status": "success",
    "message": "Mensaje enviado"
}
 

Request   

POST api/broadcast/sendCustomerPresenceChannel

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Authorization        

Example: string required Bearer token (auth:sanctum).

Content-Type        

Example: application/json

Body Parameters

chatId   string  optional    

Chat opcional. Example: "chat-123"

customerId   integer     

Id del cliente. Example: 9

message   string     

Mensaje (max 1000). Example: "Hola cliente"

room_id   string     

Identificador del room. Example: "room-1"

Indicador de escribiendo en canal de cliente

requires authentication

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/broadcast/userPresenceCustomerChannelTyping';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Authorization' => 'string required Bearer token (auth:sanctum).',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'customerId' => 9,
            'room_id' => '"room-1"',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/broadcast/userPresenceCustomerChannelTyping"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Authorization": "string required Bearer token (auth:sanctum).",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "customerId": 9,
    "room_id": "\"room-1\""
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "status": "success"
}
 

Request   

POST api/broadcast/userPresenceCustomerChannelTyping

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Authorization        

Example: string required Bearer token (auth:sanctum).

Content-Type        

Example: application/json

Body Parameters

customerId   integer     

Id del cliente. Example: 9

room_id   string     

Identificador del room. Example: "room-1"

Enviar mensaje a canal de presencia WAP

requires authentication

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/broadcast/sendPresenceWAPChannel';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Authorization' => 'string required Bearer token (auth:sanctum).',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'chatId' => '"chat-123"',
            'message' => '"Mensaje WAP"',
            'room_id' => '"room-1"',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/broadcast/sendPresenceWAPChannel"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Authorization": "string required Bearer token (auth:sanctum).",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "chatId": "\"chat-123\"",
    "message": "\"Mensaje WAP\"",
    "room_id": "\"room-1\""
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "status": "success",
    "message": "Mensaje enviado"
}
 

Request   

POST api/broadcast/sendPresenceWAPChannel

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Authorization        

Example: string required Bearer token (auth:sanctum).

Content-Type        

Example: application/json

Body Parameters

chatId   string  optional    

Chat opcional. Example: "chat-123"

message   string     

Mensaje (max 1000). Example: "Mensaje WAP"

room_id   string     

Identificador del room. Example: "room-1"

Chat

Listar chats

requires authentication

Devuelve los chats visibles para el usuario, con filtros y paginacion opcional.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/chat/list';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Authorization' => 'string required Bearer token de autenticacion (auth:sanctum).',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'paginate' => '"N"',
            'quantity_x_page' => 10,
            'filters' => [
                'name' => 'Cliente A',
            ],
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/chat/list"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Authorization": "string required Bearer token de autenticacion (auth:sanctum).",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "paginate": "\"N\"",
    "quantity_x_page": 10,
    "filters": {
        "name": "Cliente A"
    },
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "data": [
            {
                "id_chat": "chat-123",
                "name": "Cliente A",
                "last_message": "Hola",
                "unread": 2
            }
        ]
    },
    "status": "success",
    "message": "Operacion exitosa",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "paginate": [
                "El campo paginate debe ser \"S\" o \"N\"."
            ]
        }
    },
    "status": "error",
    "message": "Validacion fallida.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

POST api/chat/list

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Authorization        

Example: string required Bearer token de autenticacion (auth:sanctum).

Content-Type        

Example: application/json

Body Parameters

paginate   string     

Define si se pagina la respuesta. Valores: "S" o "N". Example: "N"

quantity_x_page   integer  optional    

Cantidad de filas por pagina (1-100). Example: 10

filters   object  optional    

Filtros opcionales.

name   string  optional    

Nombre o parte del nombre del chat/usuario asignado. Example: "Cliente A"

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Listar usuarios de chat

requires authentication

Devuelve usuarios disponibles para chat con filtros y paginacion opcional.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/chat/listChatUsers';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Authorization' => 'string required Bearer token de autenticacion (auth:sanctum).',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'paginate' => '"N"',
            'quantity_x_page' => 10,
            'filters' => [
                'name' => 'Agente',
            ],
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/chat/listChatUsers"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Authorization": "string required Bearer token de autenticacion (auth:sanctum).",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "paginate": "\"N\"",
    "quantity_x_page": 10,
    "filters": {
        "name": "Agente"
    },
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "data": [
            {
                "id": 7,
                "name": "Agente 1",
                "email": "agente1@empresa.com"
            }
        ]
    },
    "status": "success",
    "message": "Operacion exitosa",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Request   

POST api/chat/listChatUsers

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Authorization        

Example: string required Bearer token de autenticacion (auth:sanctum).

Content-Type        

Example: application/json

Body Parameters

paginate   string     

Define si se pagina la respuesta. Valores: "S" o "N". Example: "N"

quantity_x_page   integer  optional    

Cantidad de filas por pagina (1-100). Example: 10

filters   object  optional    

Filtros opcionales.

name   string  optional    

Nombre o parte del nombre del usuario. Example: "Agente"

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Obtener mensajes de un chat

requires authentication

Lista los mensajes del chat indicado.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/chat/getChatMessages';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Authorization' => 'string required Bearer token de autenticacion (auth:sanctum).',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id_chat' => '"chat-123"',
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/chat/getChatMessages"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Authorization": "string required Bearer token de autenticacion (auth:sanctum).",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id_chat": "\"chat-123\"",
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "messages": [
            {
                "id_message": "msg-1",
                "text": "Hola",
                "sender_id": 7
            }
        ]
    },
    "status": "success",
    "message": "Operacion exitosa",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "id_chat": [
                "El campo id_chat es obligatorio."
            ]
        }
    },
    "status": "error",
    "message": "Validacion fallida.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

POST api/chat/getChatMessages

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Authorization        

Example: string required Bearer token de autenticacion (auth:sanctum).

Content-Type        

Example: application/json

Body Parameters

id_chat   string     

Identificador del chat. Example: "chat-123"

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Obtener usuarios de un chat

requires authentication

Devuelve los usuarios participantes de un chat.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/chat/getChatUsers';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Authorization' => 'string required Bearer token de autenticacion (auth:sanctum).',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id_chat' => '"chat-123"',
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/chat/getChatUsers"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Authorization": "string required Bearer token de autenticacion (auth:sanctum).",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id_chat": "\"chat-123\"",
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "users": [
            {
                "id": 7,
                "name": "Agente 1"
            }
        ]
    },
    "status": "success",
    "message": "Operacion exitosa",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Request   

POST api/chat/getChatUsers

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Authorization        

Example: string required Bearer token de autenticacion (auth:sanctum).

Content-Type        

Example: application/json

Body Parameters

id_chat   string     

Identificador del chat. Example: "chat-123"

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Enviar mensaje

requires authentication

Envia un mensaje dentro de un chat.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/chat/sendChatMessage';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Authorization' => 'string required Bearer token de autenticacion (auth:sanctum).',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id_chat' => '"chat-123"',
            'message' => '"Hola, ¿en que puedo ayudarte?"',
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/chat/sendChatMessage"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Authorization": "string required Bearer token de autenticacion (auth:sanctum).",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id_chat": "\"chat-123\"",
    "message": "\"Hola, ¿en que puedo ayudarte?\"",
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id_message": "msg-2",
        "id_chat": "chat-123",
        "message": "Hola, ¿en que puedo ayudarte?",
        "sender_id": 7
    },
    "status": "ok",
    "message": "Mensaje enviado.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "id_chat": [
                "El id_chat no se encuentra registrado."
            ]
        }
    },
    "status": "error",
    "message": "Validacion fallida.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

POST api/chat/sendChatMessage

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Authorization        

Example: string required Bearer token de autenticacion (auth:sanctum).

Content-Type        

Example: application/json

Body Parameters

id_chat   string     

Identificador del chat. Example: "chat-123"

message   string     

Contenido del mensaje. Example: "Hola, ¿en que puedo ayudarte?"

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Marcar mensajes como leidos

requires authentication

Marca un mensaje (o mensajes) de un chat como leidos.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/chat/markAsReadMessage';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Authorization' => 'string required Bearer token de autenticacion (auth:sanctum).',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id_message' => '"msg-2"',
            'id_chat' => '"chat-123"',
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/chat/markAsReadMessage"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Authorization": "string required Bearer token de autenticacion (auth:sanctum).",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id_message": "\"msg-2\"",
    "id_chat": "\"chat-123\"",
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id_message": "msg-2",
        "id_chat": "chat-123",
        "status": "read"
    },
    "status": "ok",
    "message": "Mensaje marcado como leido.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "id_message": [
                "El id_message no se encuentra registrado."
            ]
        }
    },
    "status": "error",
    "message": "Validacion fallida.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

POST api/chat/markAsReadMessage

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Authorization        

Example: string required Bearer token de autenticacion (auth:sanctum).

Content-Type        

Example: application/json

Body Parameters

id_message   string     

Identificador del mensaje. Example: "msg-2"

id_chat   string     

Identificador del chat. Example: "chat-123"

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Endpoints sin agrupar

POST api/correo/getConfigCorreos

requires authentication

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/correo/getConfigCorreos';
$response = $client->post($url);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/correo/getConfigCorreos"
);

fetch(url, {
    method: "POST",
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "error": "Not Found",
    "code": 404
}
 

Request   

POST api/correo/getConfigCorreos

Display a listing of the resource.

requires authentication

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/deptos/index';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'page' => 'N',
            'quantity_x_page' => 13,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/deptos/index"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "page": "N",
    "quantity_x_page": 13
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "error": "Not Found",
    "code": 404
}
 

Request   

POST api/deptos/index

Headers

Content-Type        

Example: application/json

Body Parameters

page   string     

Example: N

Must be one of:
  • N
  • S
filters   object  optional    
quantity_x_page   integer  optional    

Example: 13

GET api/deptos/show/{id}

requires authentication

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/deptos/show/dignissimos';
$response = $client->get($url);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/deptos/show/dignissimos"
);

fetch(url, {
    method: "GET",
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "error": "Not Found",
    "code": 404
}
 

Request   

GET api/deptos/show/{id}

URL Parameters

id   string     

The ID of the show. Example: dignissimos

Display a listing of the resource.

requires authentication

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/company/index';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'page' => 'N',
            'quantity_x_page' => 7,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/company/index"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "page": "N",
    "quantity_x_page": 7
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "error": "Not Found",
    "code": 404
}
 

Request   

POST api/company/index

Headers

Content-Type        

Example: application/json

Body Parameters

page   string     

Example: N

Must be one of:
  • N
  • S
filters   object  optional    
quantity_x_page   integer  optional    

Example: 7

Display the specified resource.

requires authentication

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/company/show/veritatis';
$response = $client->get($url);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/company/show/veritatis"
);

fetch(url, {
    method: "GET",
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "error": "Not Found",
    "code": 404
}
 

Request   

GET api/company/show/{id}

URL Parameters

id   string     

The ID of the show. Example: veritatis

Remove the specified resource from storage.

requires authentication

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/company/delete/aut';
$response = $client->delete($url);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/company/delete/aut"
);

fetch(url, {
    method: "DELETE",
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "error": "Not Found",
    "code": 404
}
 

Request   

DELETE api/company/delete/{id}

URL Parameters

id   string     

The ID of the delete. Example: aut

Display a listing of the resource.

requires authentication

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/plan/index';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'page' => 'S',
            'quantity_x_page' => 6,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/plan/index"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "page": "S",
    "quantity_x_page": 6
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "error": "Not Found",
    "code": 404
}
 

Request   

POST api/plan/index

Headers

Content-Type        

Example: application/json

Body Parameters

page   string     

Example: S

Must be one of:
  • N
  • S
filters   object  optional    
quantity_x_page   integer  optional    

Example: 6

Guest

Registrar invitado

requires authentication

Crea un usuario invitado y devuelve su token.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/guest/store';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'name' => '"Cliente WAP"',
            'email' => '"cliente@correo.com"',
            'phone' => '"50688888888"',
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/guest/store"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "\"Cliente WAP\"",
    "email": "\"cliente@correo.com\"",
    "phone": "\"50688888888\"",
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "usuario": {
            "id": 12,
            "name": "Cliente WAP",
            "email": "cliente@correo.com",
            "phone": "50688888888",
            "token": "guest-token-123"
        },
        "token": "guest-token-123"
    },
    "status": "ok",
    "message": "Usuario invitado registrado",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "message": "The name field is required."
}
 

Request   

POST api/guest/store

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

name   string     

Nombre del invitado. Example: "Cliente WAP"

email   string  optional    

Correo del invitado. Example: "cliente@correo.com"

phone   string     

Numero de telefono. Example: "50688888888"

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Obtener token de chat por telefono

requires authentication

Retorna el token del invitado usando su numero de telefono.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/guest/get_token_by_phone/"50688888888"';
$response = $client->get(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Authorization' => 'string required Bearer token (auth:sanctum).',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/guest/get_token_by_phone/"50688888888""
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Authorization": "string required Bearer token (auth:sanctum).",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "GET",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "token": "guest-token-123"
    },
    "status": "ok",
    "message": "Consulta Token Invitado",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (400):


{
    "status": "error",
    "message": "Usuario no encontrado",
    "code": 400,
    "id_bitacora_log": 736014
}
 

Request   

GET api/guest/get_token_by_phone/{phone}

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Authorization        

Example: string required Bearer token (auth:sanctum).

Content-Type        

Example: application/json

URL Parameters

phone   string     

Numero de telefono del invitado. Example: "50688888888"

Body Parameters

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Meta WhatsApp

Enviar mensaje WAP

requires authentication

Envía texto o media a traves de WhatsApp (Meta). Requiere autenticacion.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/meta/sendMessagesWAP';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Authorization' => 'string required Bearer token (auth:sanctum).',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'whatsapp_channel' => '"12"',
            'to' => '"50688888888"',
            'message' => '"Hola desde Meta"',
            'tokenGuest' => '"guest-token"',
            'file' => '"data:image/png;base64,iVBORw0KGgoAAA..."',
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/meta/sendMessagesWAP"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Authorization": "string required Bearer token (auth:sanctum).",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "whatsapp_channel": "\"12\"",
    "to": "\"50688888888\"",
    "message": "\"Hola desde Meta\"",
    "tokenGuest": "\"guest-token\"",
    "file": "\"data:image\/png;base64,iVBORw0KGgoAAA...\"",
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {},
    "status": "ok",
    "message": "Mensaje Meta Enviado",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (401):


{
    "message": "Unauthenticated."
}
 

Request   

POST api/meta/sendMessagesWAP

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Authorization        

Example: string required Bearer token (auth:sanctum).

Content-Type        

Example: application/json

Body Parameters

whatsapp_channel   string     

Id del canal whatsappfb. Example: "12"

to   string     

Numero destino. Example: "50688888888"

message   string     

Mensaje de texto. Example: "Hola desde Meta"

tokenGuest   string  optional    

Token del invitado (si aplica). Example: "guest-token"

file   string  optional    

Archivo en base64 (opcional). Example: "data:image/png;base64,iVBORw0KGgoAAA..."

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Listar canales WhatsApp (Meta)

requires authentication

Devuelve los canales whatsappfb activos.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/meta/getChannelSettingsList';
$response = $client->get(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Authorization' => 'string required Bearer token (auth:sanctum).',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/meta/getChannelSettingsList"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Authorization": "string required Bearer token (auth:sanctum).",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "GET",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": [
        {
            "id_channel": 1,
            "name": "Canal WAP",
            "uuid": "abc-123",
            "company": 3,
            "type": "whatsappfb",
            "channel_status": 1
        }
    ],
    "status": "ok",
    "message": "Mensaje Meta Enviado",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Request   

GET api/meta/getChannelSettingsList

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Authorization        

Example: string required Bearer token (auth:sanctum).

Content-Type        

Example: application/json

Body Parameters

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora. Example: 736014

Webhook de mensajes WAP (Meta)

Recibe eventos entrantes de WhatsApp (Meta). Publico sin auth.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/meta/readMessagesWAP';
$response = $client->post($url);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/meta/readMessagesWAP"
);

fetch(url, {
    method: "POST",
}).then(response => response.json());

Example response (200):


{
    "data": {
        "guest": {},
        "file": null
    },
    "status": "ok",
    "message": "Mensaje Meta Recibido",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Request   

POST api/meta/readMessagesWAP

Obtener archivo WAP

Devuelve un archivo multimedia recibido de Meta.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/meta/getMediaFile';
$response = $client->get(
    $url,
    [
        'query' => [
            'filename' => '"photo_12345.jpg"',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/meta/getMediaFile"
);

const params = {
    "filename": ""photo_12345.jpg"",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

fetch(url, {
    method: "GET",
}).then(response => response.json());

Example response (200):


binary
 

Example response (400):


{
    "status": "error",
    "message": "Archivo no encontrado"
}
 

Request   

GET api/meta/getMediaFile

Query Parameters

filename   string     

Nombre del archivo. Example: "photo_12345.jpg"

SuperAdmin Canales

Listar canales

requires authentication

Devuelve los canales de una empresa con filtros y paginacion opcional.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/admin/channels/list';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id_company' => 3,
            'paginate' => '"S"',
            'page' => 1,
            'quantity_x_page' => 10,
            'filters' => [
                'name' => 'Canal',
                'type' => 'telegram',
                'uuid' => 'abc-123',
                'app_id' => 'whatsapp-app',
            ],
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/admin/channels/list"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id_company": 3,
    "paginate": "\"S\"",
    "page": 1,
    "quantity_x_page": 10,
    "filters": {
        "name": "Canal",
        "type": "telegram",
        "uuid": "abc-123",
        "app_id": "whatsapp-app"
    },
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Listado paginado):


{
    "data": {
        "current_page": 1,
        "data": [
            {
                "id_channel": 9,
                "company": 3,
                "name": "WhatsApp Principal",
                "app": "whatsapp-business",
                "uuid": "c169c38d-a790-4a6f-8da0-6f5e3c2f9c0a",
                "type": "whatsapp",
                "token": "****",
                "channel_status": 1
            }
        ],
        "from": 1,
        "last_page": 1,
        "per_page": 10,
        "to": 1,
        "total": 1
    },
    "status": "ok",
    "message": "Canales listados correctamente.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (200, Listado sin paginar):


{
    "data": [
        {
            "id_channel": 9,
            "company": 3,
            "name": "WhatsApp Principal",
            "app": "whatsapp-business",
            "uuid": "c169c38d-a790-4a6f-8da0-6f5e3c2f9c0a",
            "type": "whatsapp",
            "token": "****",
            "channel_status": 1
        }
    ],
    "status": "ok",
    "message": "Canales listados correctamente.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "id_company": [
                "El id de la empresa es obligatorio."
            ]
        }
    },
    "status": "error",
    "message": "Errores de validacion.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

POST api/admin/channels/list

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

id_company   integer     

Identificador de la empresa propietaria. Example: 3

paginate   string  optional    

Define si se pagina la respuesta. Valores: "S" (por defecto) o "N". Example: "S"

page   integer  optional    

Numero de pagina cuando paginate es "S". Example: 1

quantity_x_page   integer  optional    

Cantidad de filas por pagina cuando paginate es "S" (1-100). Example: 10

filters   object  optional    

Filtros opcionales.

name   string  optional    

Nombre o parte del nombre del canal. Example: "WhatsApp"

type   string  optional    

Tipo de canal (instagram, messenger, telegram, webchat, whatsapp, whatsappfb). Example: "telegram"

uuid   string  optional    

UUID del canal. Example: "c169c38d-a790-4a6f-8da0-6f5e3c2f9c0a"

app_id   string  optional    

Identificador/appId del canal. Example: "123456"

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Crear canal

requires authentication

Crea un canal para una empresa.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/admin/channels/store';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id_company' => 3,
            'name' => '"WhatsApp Principal"',
            'app' => '"whatsapp-business"',
            'type' => '"whatsapp"',
            'token' => '"EAA..."',
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/admin/channels/store"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id_company": 3,
    "name": "\"WhatsApp Principal\"",
    "app": "\"whatsapp-business\"",
    "type": "\"whatsapp\"",
    "token": "\"EAA...\"",
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id_channel": 9,
        "company": 3,
        "name": "WhatsApp Principal",
        "app": "whatsapp-business",
        "uuid": "c169c38d-a790-4a6f-8da0-6f5e3c2f9c0a",
        "type": "whatsapp",
        "token": "****",
        "channel_status": 1
    },
    "status": "ok",
    "message": "Canal actualizado correctamente.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "token": [
                "El token es obligatorio salvo cuando el tipo es telegram."
            ]
        }
    },
    "status": "error",
    "message": "Errores de validacion.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

POST api/admin/channels/store

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

id_company   integer     

Identificador de la empresa propietaria. Example: 3

name   string     

Nombre del canal. Example: "WhatsApp Principal"

app   string     

Identificador de la app/cuenta (para telegram es el bot token). Example: "whatsapp-business"

type   string     

Tipo de canal (instagram, messenger, telegram, webchat, whatsapp, whatsappfb). Example: "whatsapp"

token   string  optional    

Token de acceso (obligatorio salvo type=telegram). Example: "EAA..."

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Actualizar canal

requires authentication

Actualiza parcialmente un canal (nombre, app, tipo, token, secret_key, additional_app_id).

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/admin/channels/update';
$response = $client->patch(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id_channel' => 9,
            'id_company' => 3,
            'name' => '"WhatsApp Secundario"',
            'app' => '"whatsapp-business-2"',
            'type' => '"whatsapp"',
            'token' => '"EAA..."',
            'secret_key' => '"shh-123"',
            'additional_app_id' => '"app-aux-01"',
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/admin/channels/update"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id_channel": 9,
    "id_company": 3,
    "name": "\"WhatsApp Secundario\"",
    "app": "\"whatsapp-business-2\"",
    "type": "\"whatsapp\"",
    "token": "\"EAA...\"",
    "secret_key": "\"shh-123\"",
    "additional_app_id": "\"app-aux-01\"",
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "PATCH",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Actualizado):


{
    "data": {
        "id_channel": 9,
        "company": 3,
        "name": "WhatsApp Secundario",
        "app": "whatsapp-business-2",
        "type": "whatsapp",
        "token": "****",
        "uuid": "c169c38d-a790-4a6f-8da0-6f5e3c2f9c0a",
        "secret_key": "shh-123",
        "additional_app_id": "app-aux-01",
        "channel_status": 1
    },
    "status": "ok",
    "message": "Canal actualizado correctamente.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (404):


{
    "data": null,
    "status": "error",
    "message": "El canal no pertenece al cliente indicado o no existe.",
    "code": 404,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "general": [
                "Debe editar al menos un campo."
            ]
        }
    },
    "status": "error",
    "message": "Parametros invalidos.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

PATCH api/admin/channels/update

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

id_channel   integer     

Identificador del canal a actualizar. Example: 9

id_company   integer     

Identificador de la empresa propietaria. Example: 3

name   string  optional    

Nombre del canal. Example: "WhatsApp Secundario"

app   string  optional    

Identificador de la app/cuenta. Example: "whatsapp-business-2"

type   string  optional    

Tipo del canal (instagram, messenger, telegram, webchat, whatsapp, whatsappfb). Example: "whatsapp"

token   string  optional    

Token de acceso (obligatorio cuando type no es telegram). Example: "EAA..."

secret_key   string  optional    

Clave secreta opcional. Example: "shh-123"

additional_app_id   string  optional    

Id adicional opcional. Example: "app-aux-01"

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Buscar canal

requires authentication

Obtiene el detalle de un canal por empresa, id y tipo.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/admin/channels/show';
$response = $client->get(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id_company' => 3,
            'id_channel' => 9,
            'type_channel' => '"whatsapp"',
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/admin/channels/show"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id_company": 3,
    "id_channel": 9,
    "type_channel": "\"whatsapp\"",
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "GET",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id_channel": 9,
        "company": 3,
        "name": "WhatsApp Principal",
        "app": "whatsapp-business",
        "uuid": "c169c38d-a790-4a6f-8da0-6f5e3c2f9c0a",
        "type": "whatsapp",
        "token": "****",
        "channel_status": 1
    },
    "status": "ok",
    "message": "",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (404):


{
    "data": null,
    "status": "error",
    "message": "Canal no encontrado para los criterios enviados.",
    "code": 404,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "id_channel": [
                "El parametro id_channel es obligatorio."
            ]
        }
    },
    "status": "error",
    "message": "Errores de validacion.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

GET api/admin/channels/show

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

id_company   integer     

Identificador de la empresa propietaria. Example: 3

id_channel   integer     

Identificador del canal. Example: 9

type_channel   string     

Tipo del canal (instagram, messenger, telegram, webchat, whatsapp, whatsappfb). Example: "whatsapp"

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Actualizar estado del canal

requires authentication

Activa o inactiva un canal.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/admin/channels/update-status';
$response = $client->patch(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id_channel' => 9,
            'channel_status' => 1,
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/admin/channels/update-status"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id_channel": 9,
    "channel_status": 1,
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "PATCH",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Estado actualizado):


{
    "data": {
        "id_channel": 9,
        "channel_status": 0
    },
    "status": "ok",
    "message": "Estado de canal actualizado correctamente.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (200, Sin cambios):


{
    "data": {
        "id_channel": 9,
        "channel_status": 1
    },
    "status": "ok",
    "message": "Sin cambios: el canal ya se encuentra en el estado solicitado.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (404):


{
    "data": null,
    "status": "error",
    "message": "El canal indicado no existe.",
    "code": 404,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "channel_status": [
                "El estado debe ser 0 (Inactivo) o 1 (Activo)."
            ]
        }
    },
    "status": "error",
    "message": "Errores de validacion.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

PATCH api/admin/channels/update-status

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

id_channel   integer     

Identificador del canal a actualizar. Example: 9

channel_status   integer     

Estado del canal: 1 activo, 0 inactivo. Example: 1

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

SuperAdmin Clientes

Listar clientes

requires authentication

Devuelve clientes con filtros y paginacion opcional.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/admin/clients/list';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'paginate' => '"S"',
            'page' => 1,
            'quantity_x_page' => 10,
            'filters' => [
                'name' => 'Empresa',
                'email' => 'contacto@empresa.com',
                'token' => 'abc',
                'plan' => 'Basico',
            ],
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/admin/clients/list"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "paginate": "\"S\"",
    "page": 1,
    "quantity_x_page": 10,
    "filters": {
        "name": "Empresa",
        "email": "contacto@empresa.com",
        "token": "abc",
        "plan": "Basico"
    },
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Listado paginado):


{
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 5,
                "name": "Empresa Demo",
                "email": "demo@empresa.com",
                "token": "2c359f63-95b5-4a6c-a507-7f2bfa0c3c9a",
                "id_plan": 1,
                "balance": 0,
                "pay_day": "2024-12-15 00:00:00",
                "api": 0,
                "messenger": 0,
                "telegram": 0
            }
        ],
        "from": 1,
        "last_page": 1,
        "per_page": 10,
        "to": 1,
        "total": 1
    },
    "status": "success",
    "message": "Operacion exitosa",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (200, Listado sin paginar):


{
    "data": [
        {
            "id": 5,
            "name": "Empresa Demo",
            "email": "demo@empresa.com",
            "token": "2c359f63-95b5-4a6c-a507-7f2bfa0c3c9a",
            "id_plan": 1,
            "balance": 0,
            "pay_day": "2024-12-15 00:00:00",
            "api": 0,
            "messenger": 0,
            "telegram": 0
        }
    ],
    "status": "success",
    "message": "Operacion exitosa",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "paginate": [
                "El campo paginate debe ser \"S\" o \"N\"."
            ]
        }
    },
    "status": "error",
    "message": "Errores de validacion.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

POST api/admin/clients/list

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

paginate   string  optional    

Define si se pagina la respuesta. Valores: "S" (por defecto) o "N". Example: "S"

page   integer  optional    

Numero de pagina cuando paginate es "S". Example: 1

quantity_x_page   integer  optional    

Cantidad de filas por pagina cuando paginate es "S" (1-100). Example: 10

filters   object  optional    

Filtros opcionales.

name   string  optional    

Nombre o parte del nombre del cliente. Example: "Empresa"

email   string  optional    

Correo del cliente. Example: "contacto@empresa.com"

token   string  optional    

Token de consumo. Example: "a4e1b2c3-d4e5-6789"

plan   string  optional    

Nombre del plan. Example: "Basico"

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Crear cliente

requires authentication

Crea un cliente, su departamento GENERAL y el usuario administrador inicial.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/admin/clients/store';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'name' => '"Empresa Demo"',
            'email' => '"demo@empresa.com"',
            'id_plan' => 2,
            'balance' => '0',
            'pay_day' => '"2024-12-15"',
            'user_name' => '"Admin Demo"',
            'user_email' => '"admin@empresa.com"',
            'password' => '"Secret123"',
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/admin/clients/store"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "\"Empresa Demo\"",
    "email": "\"demo@empresa.com\"",
    "id_plan": 2,
    "balance": "0",
    "pay_day": "\"2024-12-15\"",
    "user_name": "\"Admin Demo\"",
    "user_email": "\"admin@empresa.com\"",
    "password": "\"Secret123\"",
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (201):


{
    "data": {
        "company": {
            "id": 10,
            "name": "Empresa Demo",
            "email": "demo@empresa.com",
            "token": "0d2b4f5e-8c3f-4a4e-9c5d-2b5a4c1d9e6f",
            "id_plan": 2,
            "pay_day": "2024-12-15 00:00:00",
            "balance": 0
        },
        "department": {
            "id_department": 21,
            "department_name": "GENERAL"
        },
        "user": {
            "id": 33,
            "name": "Admin Demo",
            "email": "admin@empresa.com",
            "type": "2",
            "company": 10,
            "department": 21
        },
        "faq": {
            "id_faq": 5
        }
    },
    "status": "ok",
    "message": "Cliente creado correctamente.",
    "code": 201,
    "id_bitacora_log": 736014
}
 

Example response (409):


{
    "data": {
        "errors": {
            "duplicate": [
                "Registro duplicado. Verifique correos o token."
            ]
        }
    },
    "status": "error",
    "message": "Conflicto de unicidad.",
    "code": 409,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "email": [
                "El correo de la compania es obligatorio."
            ]
        }
    },
    "status": "error",
    "message": "Errores de validacion.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

POST api/admin/clients/store

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

name   string     

Nombre de la empresa. Example: "Empresa Demo"

email   string     

Correo de la empresa (unico). Example: "demo@empresa.com"

id_plan   integer     

Identificador del plan contratado. Example: 2

balance   numeric     

Balance inicial. Example: 0

pay_day   date     

Fecha de cobro (Y-m-d). Example: "2024-12-15"

user_name   string     

Nombre del usuario administrador. Example: "Admin Demo"

user_email   string     

Correo del usuario administrador (unico). Example: "admin@empresa.com"

password   string     

Contrasena del usuario administrador. Example: "Secret123"

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Actualizar cliente

requires authentication

Actualiza parcialmente datos del cliente (nombre, correo, balance, fecha de pago, plan, flags de acceso).

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/admin/clients/update';
$response = $client->patch(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id' => 10,
            'name' => '"Empresa Demo 2"',
            'email' => '"demo2@empresa.com"',
            'balance' => '150.75',
            'pay_day' => '"2024-12-20"',
            'id_plan' => 3,
            'api' => 1,
            'messenger' => 0,
            'telegram' => 1,
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/admin/clients/update"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id": 10,
    "name": "\"Empresa Demo 2\"",
    "email": "\"demo2@empresa.com\"",
    "balance": "150.75",
    "pay_day": "\"2024-12-20\"",
    "id_plan": 3,
    "api": 1,
    "messenger": 0,
    "telegram": 1,
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "PATCH",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Actualizado):


{
    "data": {
        "id": 10,
        "name": "Empresa Demo 2",
        "email": "demo2@empresa.com",
        "balance": 150.75,
        "pay_day": "2024-12-20 00:00:00",
        "id_plan": 3,
        "api": 1,
        "messenger": 0,
        "telegram": 1
    },
    "status": "ok",
    "message": "Cliente actualizado correctamente.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (200, Sin cambios):


{
    "data": {
        "id": 10,
        "name": "Empresa Demo",
        "email": "demo@empresa.com",
        "balance": 0,
        "pay_day": "2024-12-15 00:00:00",
        "id_plan": 2,
        "api": 0,
        "messenger": 0,
        "telegram": 0
    },
    "status": "ok",
    "message": "No hubo cambios; los valores ya estaban aplicados.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (404):


{
    "data": [],
    "status": "error",
    "message": "El cliente indicado no existe.",
    "code": 404,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "id": [
                "El id del cliente es obligatorio."
            ]
        }
    },
    "status": "error",
    "message": "Errores de validacion.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

PATCH api/admin/clients/update

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

id   integer     

Identificador del cliente a actualizar. Example: 10

name   string  optional    

Nombre del cliente. Example: "Empresa Demo 2"

email   string  optional    

Correo del cliente. Example: "demo2@empresa.com"

balance   numeric  optional    

Balance del cliente. Example: 150.75

pay_day   string  optional    

Fecha de cobro (Y-m-d). Example: "2024-12-20"

id_plan   integer  optional    

Id del plan. Example: 3

api   integer  optional    

Acceso API (0 o 1). Example: 1

messenger   integer  optional    

Acceso Messenger (0 o 1). Example: 0

telegram   integer  optional    

Acceso Telegram (0 o 1). Example: 1

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

requires authentication

Obtiene el detalle de un cliente por su identificador.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/admin/clients/search';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id_company' => 10,
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/admin/clients/search"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id_company": 10,
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id_client": 10,
        "name_client": "Empresa Demo",
        "email": "demo@empresa.com",
        "balance": 0,
        "billing_day": "2024-12-15",
        "id_plan": 2,
        "access_api": false,
        "access_messenger": false,
        "access_telegram": false
    },
    "status": "ok",
    "message": "",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (404):


{
    "data": [],
    "status": "error",
    "message": "Cliente no encontrado",
    "code": 404,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "id_company": [
                "El ID del cliente es obligatorio."
            ]
        }
    },
    "status": "error",
    "message": "Errores de validacion.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

SuperAdmin Departamentos

Listar departamentos

requires authentication

Devuelve los departamentos con filtros y paginacion opcional.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/admin/departments/list';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'paginate' => '"S"',
            'page' => 1,
            'quantity_x_page' => 10,
            'filters' => [
                'name' => 'Soporte',
                'id_company' => 3,
                'hour' => '"08:00"',
            ],
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/admin/departments/list"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "paginate": "\"S\"",
    "page": 1,
    "quantity_x_page": 10,
    "filters": {
        "name": "Soporte",
        "id_company": 3,
        "hour": "\"08:00\""
    },
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Listado paginado):


{
    "data": {
        "current_page": 1,
        "data": [
            {
                "id_department": 7,
                "uuid": "c169c38d-a790-4a6f-8da0-6f5e3c2f9c0a",
                "company": 3,
                "department_name": "Soporte",
                "hour": ""
            }
        ],
        "from": 1,
        "last_page": 1,
        "per_page": 10,
        "to": 1,
        "total": 1
    },
    "status": "success",
    "message": "Operacion exitosa",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (200, Listado sin paginar):


{
    "data": [
        {
            "id_department": 7,
            "uuid": "c169c38d-a790-4a6f-8da0-6f5e3c2f9c0a",
            "company": 3,
            "department_name": "Soporte",
            "hour": ""
        }
    ],
    "status": "success",
    "message": "Operacion exitosa",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "quantity_x_page": [
                "quantity_x_page es obligatorio cuando paginate es \"S\"."
            ]
        }
    },
    "status": "error",
    "message": "Errores de validacion.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

POST api/admin/departments/list

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

paginate   string  optional    

Define si se pagina la respuesta. Valores: "S" (por defecto) o "N". Example: "S"

page   integer  optional    

Numero de pagina cuando paginate es "S". Example: 1

quantity_x_page   integer  optional    

Cantidad de filas por pagina cuando paginate es "S" (1-100). Example: 10

filters   object  optional    

Filtros opcionales.

name   string  optional    

Nombre o parte del nombre del departamento. Example: "Sop"

id_company   integer  optional    

Id de la empresa. Example: 3

hour   string  optional    

Texto para buscar por el horario guardado. Example: "08:00"

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Crear departamento

requires authentication

Crea un departamento para la empresa indicada.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/admin/departments/store';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'company' => 3,
            'department_name' => '"Soporte Tecnico"',
            'hour' => [
                'lunes_apertura' => '08:00',
                'lunes_cierre' => '17:00',
                'defecto' => 'Fuera de horario',
                'email' => 'soporte@empresa.com',
            ],
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/admin/departments/store"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "company": 3,
    "department_name": "\"Soporte Tecnico\"",
    "hour": {
        "lunes_apertura": "08:00",
        "lunes_cierre": "17:00",
        "defecto": "Fuera de horario",
        "email": "soporte@empresa.com"
    },
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (201):


{
    "data": {
        "id_department": 12,
        "uuid": "3c4c8c0a-32e3-4d14-9a2a-6c4d8b8e4a50",
        "company": 3,
        "department_name": "Soporte Tecnico",
        "hour": {
            "lunes_apertura": "08:00",
            "lunes_cierre": "17:00",
            "defecto": "Fuera de horario",
            "email": "soporte@empresa.com"
        }
    },
    "status": "ok",
    "message": "Departamento creado correctamente.",
    "code": 201,
    "id_bitacora_log": 736014
}
 

Example response (409):


{
    "data": [],
    "status": "error",
    "message": "Ya existe un departamento con ese nombre para esta compania.",
    "code": 409,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "department_name": [
                "El nombre del departamento es obligatorio."
            ]
        }
    },
    "status": "error",
    "message": "Validacion fallida.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

POST api/admin/departments/store

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

company   integer     

Id de la empresa propietaria. Example: 3

department_name   string     

Nombre del departamento (5-100 caracteres). Example: "Soporte Tecnico"

hour   object  optional    

Horario opcional en JSON.

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Actualizar departamento

requires authentication

Permite cambiar el nombre y/o el horario de un departamento existente.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/admin/departments/update';
$response = $client->patch(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id_department' => 7,
            'department_name' => '"Soporte Nivel 2"',
            'hour' => [
                'lunes_apertura' => '09:00',
                'lunes_cierre' => '18:00',
                'martes_apertura' => ':03:45',
                'miercoles_apertura' => ':12|22):00',
                'jueves_apertura' => ':07:29',
                'viernes_apertura' => ':00|22):51',
                'sabado_apertura' => '21:10',
                'domingo_apertura' => ':19:12',
                'martes_cierre' => ':14:28',
                'miercoles_cierre' => '22:47',
                'jueves_cierre' => ':04|22):09',
                'viernes_cierre' => ':16|21):40',
                'sabado_cierre' => ':03|20):50',
                'domingo_cierre' => ':19|23):11',
                'defecto' => 'uwdudlevfzphaihifbweza',
                'email' => 'okuneva.cleve@example.org',
            ],
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/admin/departments/update"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id_department": 7,
    "department_name": "\"Soporte Nivel 2\"",
    "hour": {
        "lunes_apertura": "09:00",
        "lunes_cierre": "18:00",
        "martes_apertura": ":03:45",
        "miercoles_apertura": ":12|22):00",
        "jueves_apertura": ":07:29",
        "viernes_apertura": ":00|22):51",
        "sabado_apertura": "21:10",
        "domingo_apertura": ":19:12",
        "martes_cierre": ":14:28",
        "miercoles_cierre": "22:47",
        "jueves_cierre": ":04|22):09",
        "viernes_cierre": ":16|21):40",
        "sabado_cierre": ":03|20):50",
        "domingo_cierre": ":19|23):11",
        "defecto": "uwdudlevfzphaihifbweza",
        "email": "okuneva.cleve@example.org"
    },
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "PATCH",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id_department": 7,
        "company": 3,
        "department_name": "Soporte Nivel 2",
        "hour": {
            "lunes_apertura": "09:00",
            "lunes_cierre": "18:00"
        }
    },
    "status": "ok",
    "message": "Departamento actualizado correctamente.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (404):


{
    "data": null,
    "status": "error",
    "message": "El departamento indicado no existe.",
    "code": 404,
    "id_bitacora_log": 736014
}
 

Example response (409):


{
    "data": null,
    "status": "error",
    "message": "Ya existe un departamento con ese nombre en la empresa.",
    "code": 409,
    "id_bitacora_log": 736014
}
 

Example response (422, Sin campos a actualizar):


{
    "data": {
        "errors": {
            "payload": [
                "Debe enviar al menos un atributo a actualizar (department_name u hour)."
            ]
        }
    },
    "status": "error",
    "message": "Validacion de negocio.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

PATCH api/admin/departments/update

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

id_department   integer     

Identificador del departamento a modificar. Example: 7

company   string  optional    
department_name   string  optional    

Nuevo nombre del departamento (requerido si no se envia hour). Example: "Soporte Nivel 2"

hour   object  optional    

Horario en JSON (requerido si no se envia department_name).

lunes_apertura   string  optional    

Must match the regex /^(?:[01]\d|2[0-3]):[0-5]\d$/. Example: :14|21):24

martes_apertura   string  optional    

Must match the regex /^(?:[01]\d|2[0-3]):[0-5]\d$/. Example: :03:45

miercoles_apertura   string  optional    

Must match the regex /^(?:[01]\d|2[0-3]):[0-5]\d$/. Example: :12|22):00

jueves_apertura   string  optional    

Must match the regex /^(?:[01]\d|2[0-3]):[0-5]\d$/. Example: :07:29

viernes_apertura   string  optional    

Must match the regex /^(?:[01]\d|2[0-3]):[0-5]\d$/. Example: :00|22):51

sabado_apertura   string  optional    

Must match the regex /^(?:[01]\d|2[0-3]):[0-5]\d$/. Example: 21:10

domingo_apertura   string  optional    

Must match the regex /^(?:[01]\d|2[0-3]):[0-5]\d$/. Example: :19:12

lunes_cierre   string  optional    

Must match the regex /^(?:[01]\d|2[0-3]):[0-5]\d$/. Example: :07|22):21

martes_cierre   string  optional    

Must match the regex /^(?:[01]\d|2[0-3]):[0-5]\d$/. Example: :14:28

miercoles_cierre   string  optional    

Must match the regex /^(?:[01]\d|2[0-3]):[0-5]\d$/. Example: 22:47

jueves_cierre   string  optional    

Must match the regex /^(?:[01]\d|2[0-3]):[0-5]\d$/. Example: :04|22):09

viernes_cierre   string  optional    

Must match the regex /^(?:[01]\d|2[0-3]):[0-5]\d$/. Example: :16|21):40

sabado_cierre   string  optional    

Must match the regex /^(?:[01]\d|2[0-3]):[0-5]\d$/. Example: :03|20):50

domingo_cierre   string  optional    

Must match the regex /^(?:[01]\d|2[0-3]):[0-5]\d$/. Example: :19|23):11

defecto   string  optional    

Must not be greater than 255 characters. Example: uwdudlevfzphaihifbweza

email   string  optional    

Must be a valid email address. Example: okuneva.cleve@example.org

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Actualizar estado del departamento

requires authentication

Activa o inactiva un departamento.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/admin/departments/update-status';
$response = $client->patch(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id_department' => 7,
            'status' => 1,
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/admin/departments/update-status"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id_department": 7,
    "status": 1,
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "PATCH",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Estado actualizado):


{
    "data": {
        "id_department": 7,
        "status": 0
    },
    "status": "ok",
    "message": "Estado del departamento actualizado correctamente.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (200, Sin cambios):


{
    "data": {
        "id_department": 7,
        "status": 1
    },
    "status": "ok",
    "message": "El estado enviado es igual al actual. No se realizo ningun cambio.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (404):


{
    "data": [],
    "status": "error",
    "message": "Departamento no encontrado.",
    "code": 404,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "status": [
                "El estado debe ser 0 (Inactivo) o 1 (Activo)."
            ]
        }
    },
    "status": "error",
    "message": "Validacion fallida.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

PATCH api/admin/departments/update-status

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

id_department   integer     

Identificador del departamento a actualizar. Example: 7

status   integer     

Estado del departamento: 1 activo, 0 inactivo. Example: 1

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

requires authentication

Obtiene la informacion de un departamento por su identificador.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/admin/departments/search';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id_department' => 7,
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/admin/departments/search"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id_department": 7,
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id_department": 7,
        "department_name": "Soporte",
        "company": 3,
        "hour": "{\"lunes_apertura\":\"08:00\",\"lunes_cierre\":\"17:00\"}"
    },
    "status": "ok",
    "message": "",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (404):


{
    "data": [],
    "status": "error",
    "message": "Departamento no encontrado.",
    "code": 404,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "id_department": [
                "El campo id_department es obligatorio."
            ]
        }
    },
    "status": "error",
    "message": "Errores de validacion.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

SuperAdmin FAQs

Listar FAQs

requires authentication

Devuelve las FAQs con filtros y paginacion opcional.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/admin/faqs/list';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'paginate' => '"S"',
            'page' => 1,
            'quantity_x_page' => 10,
            'filters' => [
                'replay' => 'Hola',
                'company' => 3,
                'department' => 'Ventas',
            ],
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/admin/faqs/list"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "paginate": "\"S\"",
    "page": 1,
    "quantity_x_page": 10,
    "filters": {
        "replay": "Hola",
        "company": 3,
        "department": "Ventas"
    },
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Listado paginado):


{
    "data": {
        "current_page": 1,
        "data": [
            {
                "id_faq": 5,
                "replay": "Hola, esta es la respuesta.",
                "company": 3,
                "departament": "[\"0\",\"7\"]",
                "status": 1
            }
        ],
        "from": 1,
        "last_page": 1,
        "per_page": 10,
        "to": 1,
        "total": 1
    },
    "status": "success",
    "message": "Operacion exitosa",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (200, Listado sin paginar):


{
    "data": {
        "data": [
            {
                "id_faq": 5,
                "replay": "Hola, esta es la respuesta.",
                "company": 3,
                "departament": "[\"0\",\"7\"]",
                "status": 1
            }
        ]
    },
    "status": "success",
    "message": "Operacion exitosa",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "paginate": [
                "El campo paginate debe ser \"S\" o \"N\"."
            ]
        }
    },
    "status": "error",
    "message": "Validacion fallida.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

POST api/admin/faqs/list

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

paginate   string  optional    

Define si se pagina la respuesta. Valores: "S" (por defecto) o "N". Example: "S"

page   integer  optional    

Numero de pagina cuando paginate es "S". Example: 1

quantity_x_page   integer  optional    

Cantidad de filas por pagina (1-100). Example: 10

filters   object  optional    

Filtros opcionales.

replay   string  optional    

Texto de respuesta a filtrar. Example: "Hola"

company   integer  optional    

Id de la empresa. Example: 3

department   string  optional    

Departamento. Example: "Ventas"

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Crear FAQ

requires authentication

Crea una FAQ para una empresa y departamentos.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/admin/faqs/store';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'company' => 3,
            'replay' => '"Hola, ¿en que puedo ayudarte?"',
            'departament' => [
                '0',
                '7',
            ],
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/admin/faqs/store"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "company": 3,
    "replay": "\"Hola, ¿en que puedo ayudarte?\"",
    "departament": [
        "0",
        "7"
    ],
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (201):


{
    "data": {
        "id_faq": 5,
        "company": 3,
        "replay": "Hola, ¿en que puedo ayudarte?",
        "departament": [
            "0",
            "7"
        ],
        "status": 1
    },
    "status": "ok",
    "message": "FAQ creada exitosamente.",
    "code": 201,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "departament": [
                "El campo departament es obligatorio."
            ]
        }
    },
    "status": "error",
    "message": "Validacion fallida.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

POST api/admin/faqs/store

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

company   integer     

Identificador de la empresa. Example: 3

replay   string     

Texto de la respuesta. Example: "Hola, ¿en que puedo ayudarte?"

departament   string[]     

IDs de departamentos (string numerico, "0" permite todos).

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Actualizar FAQ

requires authentication

Actualiza la respuesta y/o los departamentos de una FAQ.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/admin/faqs/update';
$response = $client->patch(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id_faq' => 5,
            'replay' => '"Respuesta actualizada"',
            'department' => [
                '0',
                '8',
            ],
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/admin/faqs/update"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id_faq": 5,
    "replay": "\"Respuesta actualizada\"",
    "department": [
        "0",
        "8"
    ],
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "PATCH",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id_faq": 5,
        "replay": "Respuesta actualizada",
        "department": [
            "0",
            "8"
        ]
    },
    "status": "ok",
    "message": "FAQ actualizado correctamente.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (404):


{
    "data": [],
    "status": "error",
    "message": "FAQ no encontrado.",
    "code": 404,
    "id_bitacora_log": 736014
}
 

Example response (422, Sin campos a actualizar):


{
    "data": {
        "errors": {
            "payload": [
                "Debes proporcionar al menos un atributo a actualizar: replay o department."
            ]
        }
    },
    "status": "error",
    "message": "Validacion fallida.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

PATCH api/admin/faqs/update

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

id_faq   integer     

Identificador de la FAQ a actualizar. Example: 5

replay   string  optional    

Texto actualizado de la respuesta. Example: "Respuesta actualizada"

department   string[]  optional    

Lista de departamentos (string numerico, "0" permite todos).

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Actualizar estado de FAQ

requires authentication

Activa o inactiva una FAQ.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/admin/faqs/update-status';
$response = $client->patch(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id_faq' => 5,
            'status' => 0,
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/admin/faqs/update-status"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id_faq": 5,
    "status": 0,
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "PATCH",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Estado actualizado):


{
    "data": {
        "id_faq": 5,
        "status": 0
    },
    "status": "ok",
    "message": "Estado de la FAQ actualizado correctamente.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (200, Sin cambios):


{
    "data": {
        "id_faq": 5,
        "status": 1,
        "note": "El estado solicitado coincide con el actual. No se realizaron cambios."
    },
    "status": "ok",
    "message": "Solicitud idempotente: sin cambios.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (404):


{
    "data": {
        "id_faq": 5
    },
    "status": "error",
    "message": "FAQ no encontrada.",
    "code": 404,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "status": [
                "El estado debe ser 0 (Inactivo) o 1 (Activo)."
            ]
        }
    },
    "status": "error",
    "message": "Validacion fallida.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

PATCH api/admin/faqs/update-status

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

id_faq   integer     

Identificador de la FAQ a actualizar. Example: 5

status   integer     

Estado de la FAQ: 1 activo, 0 inactivo. Example: 0

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

requires authentication

Obtiene una FAQ por su identificador.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/admin/faqs/search';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id_faq' => 5,
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/admin/faqs/search"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id_faq": 5,
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id_faq": 5,
        "replay": "Hola, esta es la respuesta.",
        "id_company": 3,
        "department": "[\"0\",\"7\"]"
    },
    "status": "ok",
    "message": "FAQ encontrado.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (404):


{
    "data": [],
    "status": "error",
    "message": "FAQ no encontrado.",
    "code": 404,
    "id_bitacora_log": 736014
}
 

SuperAdmin Planes

Listar planes

requires authentication

Devuelve planes con filtros y paginacion opcional.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/admin/plans/list';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'paginate' => '"S"',
            'page' => 1,
            'quantity_x_page' => 10,
            'filters' => [
                'name' => 'Basico',
            ],
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/admin/plans/list"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "paginate": "\"S\"",
    "page": 1,
    "quantity_x_page": 10,
    "filters": {
        "name": "Basico"
    },
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Listado paginado):


{
    "data": {
        "current_page": 1,
        "data": [
            {
                "id_plan": 3,
                "plan_name": "Basico",
                "total_DAU": 1000,
                "price_additional_DAU": 0.05,
                "no_DAU": 500,
                "plan_price": 49.9,
                "price_chatbot": 0,
                "price_api": 0,
                "price_messenger": 0,
                "price_telegram": 0,
                "price_whatsapp": 10,
                "price_agent": 15,
                "max_users": 20
            }
        ],
        "from": 1,
        "last_page": 1,
        "per_page": 10,
        "to": 1,
        "total": 1
    },
    "status": "ok",
    "message": "",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (200, Listado sin paginar):


{
    "data": [
        {
            "id_plan": 3,
            "plan_name": "Basico",
            "total_DAU": 1000,
            "price_additional_DAU": 0.05,
            "no_DAU": 500,
            "plan_price": 49.9,
            "price_chatbot": 0,
            "price_api": 0,
            "price_messenger": 0,
            "price_telegram": 0,
            "price_whatsapp": 10,
            "price_agent": 15,
            "max_users": 20
        }
    ],
    "status": "ok",
    "message": "",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "paginate": [
                "El campo paginate debe ser \"S\" o \"N\"."
            ]
        }
    },
    "status": "error",
    "message": "Validacion fallida.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

POST api/admin/plans/list

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

paginate   string  optional    

Define si se pagina la respuesta. Valores: "S" (por defecto) o "N". Example: "S"

page   integer  optional    

Numero de pagina cuando paginate es "S". Example: 1

quantity_x_page   integer  optional    

Cantidad de filas por pagina (1-100). Example: 10

filters   object  optional    

Filtros opcionales.

name   string  optional    

Nombre o parte del nombre del plan. Example: "Basico"

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Crear plan

requires authentication

Crea un plan con sus precios y limites.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/admin/plans/store';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'name' => '"Basico"',
            'total_dau' => '1000',
            'price_additional_dau' => '0.05',
            'no_dau' => '500',
            'plan_price' => '49.9',
            'price_api' => 0,
            'price_messenger' => 0,
            'price_telegram' => 0,
            'max_users' => 20,
            'price_chatbot' => 0,
            'price_whatsapp' => 10,
            'price_agent' => 15,
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/admin/plans/store"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "\"Basico\"",
    "total_dau": "1000",
    "price_additional_dau": "0.05",
    "no_dau": "500",
    "plan_price": "49.9",
    "price_api": 0,
    "price_messenger": 0,
    "price_telegram": 0,
    "max_users": 20,
    "price_chatbot": 0,
    "price_whatsapp": 10,
    "price_agent": 15,
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (201):


{
    "data": {
        "id_plan": 4,
        "plan_name": "Basico",
        "total_dau": 1000,
        "price_additional_dau": 0.05,
        "no_dau": 500,
        "plan_price": 49.9,
        "price_chatbot": 0,
        "price_api": 0,
        "price_messenger": 0,
        "price_telegram": 0,
        "price_whatsapp": 10,
        "price_agent": 15,
        "max_users": 20
    },
    "status": "ok",
    "message": "Plan creado correctamente",
    "code": 201,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "name": [
                "El nombre del plan es obligatorio."
            ]
        }
    },
    "status": "error",
    "message": "Errores de validacion.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

POST api/admin/plans/store

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

name   string     

Nombre del plan (3-100 caracteres). Example: "Basico"

total_dau   numeric     

Cantidad incluida de DAU. Example: 1000

price_additional_dau   numeric     

Precio adicional por DAU. Example: 0.05

no_dau   numeric     

Cantidad de NO DAU. Example: 500

plan_price   numeric     

Precio base del plan. Example: 49.9

price_api   integer     

Precio de API. Example: 0

price_messenger   integer     

Precio de Messenger. Example: 0

price_telegram   integer     

Precio de Telegram. Example: 0

max_users   integer     

Maximo de usuarios. Example: 20

price_chatbot   integer  optional    

Precio de Chatbot. Example: 0

price_whatsapp   integer  optional    

Precio de WhatsApp. Example: 10

price_agent   integer  optional    

Precio por agente. Example: 15

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Actualizar estado del plan

requires authentication

Activa o inactiva un plan.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/admin/plans/update-status';
$response = $client->patch(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id_plan' => 4,
            'state' => 1,
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/admin/plans/update-status"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id_plan": 4,
    "state": 1,
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "PATCH",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Estado actualizado):


{
    "data": {
        "id_plan": 4,
        "state": 0
    },
    "status": "ok",
    "message": "Estado de plan actualizado correctamente.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (200, Sin cambios):


{
    "data": {
        "id_plan": 4,
        "state": 1
    },
    "status": "ok",
    "message": "Sin cambios: el plan ya tenia el estado solicitado.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (500):


{
    "data": [],
    "status": "error",
    "message": "Ocurrio un error al actualizar el estado del plan.",
    "code": 500,
    "id_bitacora_log": 736014
}
 

Request   

PATCH api/admin/plans/update-status

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

id_plan   integer     

Identificador del plan a actualizar. Example: 4

state   integer     

Estado: 1 activo, 0 inactivo. Example: 1

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

SuperAdmin Usuarios

Crear usuario

requires authentication

Crea un usuario asociado a empresa y departamento.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/users/store';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'multipart/form-data',
        ],
        'multipart' => [
            [
                'name' => 'name',
                'contents' => '"Juan Perez"'
            ],
            [
                'name' => 'code',
                'contents' => '"USR-001"'
            ],
            [
                'name' => 'email',
                'contents' => '"juan@empresa.com"'
            ],
            [
                'name' => 'phone',
                'contents' => '"+50688888888"'
            ],
            [
                'name' => 'type',
                'contents' => '"2"'
            ],
            [
                'name' => 'password',
                'contents' => '"Secret123"'
            ],
            [
                'name' => 'password_confirmation',
                'contents' => '"Secret123"'
            ],
            [
                'name' => 'company',
                'contents' => '3'
            ],
            [
                'name' => 'department',
                'contents' => '7'
            ],
            [
                'name' => 'state',
                'contents' => '1'
            ],
            [
                'name' => 'id_bitacora_log',
                'contents' => '736014'
            ],
            [
                'name' => 'pic',
                'contents' => fopen('/tmp/php45gftn1t50m69Fogaj3', 'r')
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/users/store"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "multipart/form-data",
    "Accept": "application/json",
};

const body = new FormData();
body.append('name', '"Juan Perez"');
body.append('code', '"USR-001"');
body.append('email', '"juan@empresa.com"');
body.append('phone', '"+50688888888"');
body.append('type', '"2"');
body.append('password', '"Secret123"');
body.append('password_confirmation', '"Secret123"');
body.append('company', '3');
body.append('department', '7');
body.append('state', '1');
body.append('id_bitacora_log', '736014');
body.append('pic', document.querySelector('input[name="pic"]').files[0]);

fetch(url, {
    method: "POST",
    headers,
    body,
}).then(response => response.json());

Example response (201):


{
    "data": {
        "id": 15,
        "name": "Juan Perez",
        "email": "juan@empresa.com",
        "company": 3,
        "department": 7,
        "type": "2",
        "state": 1
    },
    "status": "ok",
    "message": "Usuario creado correctamente.",
    "code": 201,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "email": [
                "El correo indicado ya esta registrado."
            ]
        }
    },
    "status": "error",
    "message": "Validacion fallida.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

POST api/users/store

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: multipart/form-data

Body Parameters

name   string     

Nombre del usuario. Example: "Juan Perez"

code   string  optional    

Codigo opcional del usuario. Example: "USR-001"

email   string     

Correo (unico). Example: "juan@empresa.com"

phone   string  optional    

Telefono (con codigo de pais). Example: "+50688888888"

type   string     

Tipo de usuario (1 super, 2 admin, 3 chat). Example: "2"

password   string     

Contrasena. Example: "Secret123"

password_confirmation   string     

Confirmacion de contrasena. Example: "Secret123"

pic   file  optional    

Foto opcional (jpg/jpeg/png/webp/avif, max 2MB). Example: /tmp/php45gftn1t50m69Fogaj3

company   integer     

Id de la empresa. Example: 3

department   integer     

Id del departamento. Example: 7

state   integer  optional    

Estado: 1 activo, 0 inactivo. Example: 1

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Listar usuarios

requires authentication

Devuelve usuarios con filtros y paginacion opcional.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/users/list';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'paginate' => '"S"',
            'page' => 1,
            'quantity_x_page' => 20,
            'filters' => [
                'name' => 'Juan',
                'email' => 'juan@empresa.com',
                'id_company' => 3,
                'company_name' => 'Empresa',
                'type_user' => '2',
                'phone' => '+50688888888',
            ],
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/users/list"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "paginate": "\"S\"",
    "page": 1,
    "quantity_x_page": 20,
    "filters": {
        "name": "Juan",
        "email": "juan@empresa.com",
        "id_company": 3,
        "company_name": "Empresa",
        "type_user": "2",
        "phone": "+50688888888"
    },
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Listado paginado):


{
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 15,
                "name": "Juan Perez",
                "email": "juan@empresa.com",
                "company": 3,
                "department": 7,
                "type": "2",
                "state": 1
            }
        ],
        "from": 1,
        "last_page": 1,
        "per_page": 20,
        "to": 1,
        "total": 1
    },
    "status": "success",
    "message": "Operacion exitosa",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "paginate": [
                "El campo paginate debe ser \"S\" o \"N\"."
            ]
        }
    },
    "status": "error",
    "message": "Validacion fallida.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

POST api/users/list

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

paginate   string  optional    

Define si se pagina la respuesta. Valores: "S" (por defecto) o "N". Example: "S"

page   integer  optional    

Numero de pagina cuando paginate es "S". Example: 1

quantity_x_page   integer  optional    

Cantidad de filas por pagina (1-100). Example: 20

filters   object  optional    

Filtros opcionales.

name   string  optional    

Nombre o parte del nombre. Example: "Juan"

email   string  optional    

Correo del usuario. Example: "juan@empresa.com"

id_company   integer  optional    

Id de la empresa. Example: 3

company_name   string  optional    

Nombre de la empresa. Example: "Empresa"

type_user   string  optional    

Tipo de usuario (1,2,3). Example: "2"

phone   string  optional    

Telefono. Example: "+50688888888"

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Buscar usuario

requires authentication

Obtiene el detalle de un usuario por su id.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/users/show/15';
$response = $client->get(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id_user' => 36,
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/users/show/15"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id_user": 36,
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "GET",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id_user": 15,
        "name": "Juan Perez",
        "email": "juan@empresa.com",
        "company": 3,
        "department": 7,
        "type": "2",
        "state": 1
    },
    "status": "ok",
    "message": "",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (404):


{
    "data": [],
    "status": "error",
    "message": "El usuario indicado no existe.",
    "code": 404,
    "id_bitacora_log": 736014
}
 

Request   

GET api/users/show/{id}

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

URL Parameters

id   integer     

Id del usuario a consultar. Example: 15

Body Parameters

id_user   integer     

The id of an existing record in the users table. Must be at least 1. Example: 36

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Actualizar usuario

requires authentication

Actualiza parcialmente datos del usuario (nombre, correo, telefono, password, tipo, estado, empresa/departamento).

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/users/update/15';
$response = $client->patch(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id' => 14,
            'code' => '"USR-002"',
            'name' => '"Juan P. Actualizado"',
            'email' => '"juan.actualizado@empresa.com"',
            'phone' => '"+50677777777"',
            'password' => '"Secret456"',
            'password_confirmation' => '"Secret456"',
            'type' => '"2"',
            'online' => 1,
            'state' => true,
            'company' => 3,
            'department' => 7,
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/users/update/15"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id": 14,
    "code": "\"USR-002\"",
    "name": "\"Juan P. Actualizado\"",
    "email": "\"juan.actualizado@empresa.com\"",
    "phone": "\"+50677777777\"",
    "password": "\"Secret456\"",
    "password_confirmation": "\"Secret456\"",
    "type": "\"2\"",
    "online": 1,
    "state": true,
    "company": 3,
    "department": 7,
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "PATCH",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id": 15,
        "name": "Juan P. Actualizado",
        "email": "juan.actualizado@empresa.com",
        "company": 3,
        "department": 7,
        "type": "2",
        "state": 1
    },
    "status": "ok",
    "message": "Usuario actualizado correctamente.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (404):


{
    "data": [],
    "status": "error",
    "message": "El usuario indicado no existe.",
    "code": 404,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "department": [
                "El campo department es obligatorio cuando se envia company."
            ]
        }
    },
    "status": "error",
    "message": "Validacion fallida.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

PATCH api/users/update/{id}

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

URL Parameters

id   integer     

Id del usuario a actualizar. Example: 15

Body Parameters

id   integer     

The id of an existing record in the users table. Example: 14

code   string  optional    

Codigo del usuario. Example: "USR-002"

name   string  optional    

Nombre. Example: "Juan P. Actualizado"

email   string  optional    

Correo. Example: "juan.actualizado@empresa.com"

phone   string  optional    

Telefono. Example: "+50677777777"

password   string  optional    

Nueva contrasena (opcional). Example: "Secret456"

password_confirmation   string  optional    

Confirmacion de la contrasena. Example: "Secret456"

type   string  optional    

Tipo de usuario (1,2,3). Example: "2"

online   integer  optional    

Flag online. Example: 1

state   boolean  optional    

Estado (1 activo, 0 inactivo). Example: true

company   integer  optional    

Id de la empresa. Example: 3

department   integer  optional    

Id del departamento (obligatorio si se envia company). Example: 7

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Analizar usuarios por empresa

requires authentication

Retorna metricas/resumen de usuarios de la empresa del usuario autenticado.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/users/analizeUsersCompany';
$response = $client->get(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/users/analizeUsersCompany"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "GET",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "total": 10,
        "activos": 9,
        "inactivos": 1
    },
    "status": "ok",
    "message": "",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Request   

GET api/users/analizeUsersCompany

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Actualizar estado de usuario

requires authentication

Activa o inactiva un usuario.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/users/status/15';
$response = $client->patch(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id_user' => 15,
            'status' => 0,
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/users/status/15"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id_user": 15,
    "status": 0,
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "PATCH",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Estado actualizado):


{
    "data": {
        "id_user": 15,
        "status": 0
    },
    "status": "ok",
    "message": "Estado actualizado correctamente.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (200, Sin cambios):


{
    "data": {
        "id_user": 15,
        "status": 1
    },
    "status": "ok",
    "message": "Sin cambios: el usuario ya estaba en ese estado.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (404):


{
    "data": [],
    "status": "error",
    "message": "El usuario especificado no existe.",
    "code": 404,
    "id_bitacora_log": 736014
}
 

Request   

PATCH api/users/status/{id?}

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

URL Parameters

id   integer  optional    

Id opcional en la ruta (se usa si no se envia id_user). Example: 15

Body Parameters

id_user   integer     

Identificador del usuario a actualizar (o tomar de la ruta). Example: 15

status   integer     

Estado: 1 activo, 0 inactivo. Example: 0

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Subir foto de usuario

requires authentication

Sube/actualiza la foto del usuario a partir de un data URL base64.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/users/uploadUserPic/15';
$response = $client->patch(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id' => 44,
            'pic' => '"data:image/png;base64,iVBORw0KGgoAAA..."',
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/users/uploadUserPic/15"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id": 44,
    "pic": "\"data:image\/png;base64,iVBORw0KGgoAAA...\"",
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "PATCH",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id": 15,
        "pic_url": "https://app.test/storage/users/15.png"
    },
    "status": "ok",
    "message": "Imagen cargada correctamente.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "pic": [
                "Debe enviar la imagen en base64 en el campo pic."
            ]
        }
    },
    "status": "error",
    "message": "Validacion fallida.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

PATCH api/users/uploadUserPic/{id}

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

URL Parameters

id   integer     

Id del usuario. Example: 15

Body Parameters

id   integer     

The id of an existing record in the users table. Must be at least 1. Example: 44

pic   string     

Imagen en data URL base64 (jpeg/png/webp). Example: "data:image/png;base64,iVBORw0KGgoAAA..."

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Ver foto de usuario

requires authentication

Devuelve la foto del usuario en modo binario, url o meta.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/users/showUserPic/15';
$response = $client->get(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'query' => [
            'mode' => '"url"',
        ],
        'json' => [
            'id' => 11,
            'mode' => 'url',
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/users/showUserPic/15"
);

const params = {
    "mode": ""url"",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id": 11,
    "mode": "url",
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "GET",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id": 15,
        "pic_url": "https://app.test/storage/users/15.png"
    },
    "status": "ok",
    "message": "",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (404):


{
    "data": [],
    "status": "error",
    "message": "El usuario indicado no existe.",
    "code": 404,
    "id_bitacora_log": 736014
}
 

Request   

GET api/users/showUserPic/{id}

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

URL Parameters

id   integer     

Id del usuario. Example: 15

Query Parameters

mode   string  optional    

Modo de respuesta: binary|url|meta. Default: binary. Example: "url"

Body Parameters

id   integer     

The id of an existing record in the users table. Must be at least 1. Example: 11

mode   string  optional    

Example: url

Must be one of:
  • binary
  • url
  • meta
id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Eliminar foto de usuario

requires authentication

Borra la foto asociada al usuario.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/users/deleteUserPic/15';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id' => 79,
            'force' => true,
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/users/deleteUserPic/15"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id": 79,
    "force": true,
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "DELETE",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id": 15
    },
    "status": "ok",
    "message": "Foto eliminada correctamente.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (404):


{
    "data": [],
    "status": "error",
    "message": "El usuario indicado no existe.",
    "code": 404,
    "id_bitacora_log": 736014
}
 

Request   

DELETE api/users/deleteUserPic/{id}

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

URL Parameters

id   integer     

Id del usuario. Example: 15

Body Parameters

id   integer     

The id of an existing record in the users table. Must be at least 1. Example: 79

force   boolean  optional    

Example: true

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Login

requires authentication

Autentica un usuario con correo y contrasena.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/auth/login';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'email' => '"juan@empresa.com"',
            'password' => '"Secret123"',
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/auth/login"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "email": "\"juan@empresa.com\"",
    "password": "\"Secret123\"",
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
        "user": {
            "id": 15,
            "name": "Juan Perez",
            "email": "juan@empresa.com"
        }
    },
    "status": "ok",
    "message": "Login exitoso.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (401):


{
    "data": [],
    "status": "error",
    "message": "Credenciales invalidas.",
    "code": 401,
    "id_bitacora_log": 736014
}
 

Request   

POST api/auth/login

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

email   string     

Correo del usuario. Example: "juan@empresa.com"

password   string     

Contrasena. Example: "Secret123"

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Login con PIN

requires authentication

Autentica con correo, pin y device_id.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/auth/login/pin';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'email' => '"juan@empresa.com"',
            'pin' => '"123456"',
            'device_id' => 99,
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/auth/login/pin"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "email": "\"juan@empresa.com\"",
    "pin": "\"123456\"",
    "device_id": 99,
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
        "user": {
            "id": 15,
            "name": "Juan Perez"
        }
    },
    "status": "ok",
    "message": "Login exitoso.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (401):


{
    "data": [],
    "status": "error",
    "message": "Credenciales invalidas.",
    "code": 401,
    "id_bitacora_log": 736014
}
 

Request   

POST api/auth/login/pin

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

email   string     

Correo del usuario. Example: "juan@empresa.com"

pin   string     

PIN de acceso. Example: "123456"

device_id   integer     

Identificador del dispositivo. Example: 99

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Solicitar reset de password

requires authentication

Envia correo con el enlace de restablecimiento.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/auth/password/forgot';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'email' => '"juan@empresa.com"',
            'domain' => 'nxgjcplqttfhhi',
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/auth/password/forgot"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "email": "\"juan@empresa.com\"",
    "domain": "nxgjcplqttfhhi",
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": [],
    "status": "ok",
    "message": "Correo de recuperacion enviado.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (404):


{
    "data": [],
    "status": "error",
    "message": "El correo no esta registrado.",
    "code": 404,
    "id_bitacora_log": 736014
}
 

Request   

POST api/auth/password/forgot

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

email   string     

Correo del usuario. Example: "juan@empresa.com"

domain   string  optional    

Must not be greater than 255 characters. Example: nxgjcplqttfhhi

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Reset de password

requires authentication

Restablece la contrasena con token de recuperacion.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/auth/password/reset';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id' => 'yknji',
            'token' => '"abc123"',
            'password' => '"Nueva123"',
            'password_confirmation' => '"Nueva123"',
            'email' => '"juan@empresa.com"',
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/auth/password/reset"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id": "yknji",
    "token": "\"abc123\"",
    "password": "\"Nueva123\"",
    "password_confirmation": "\"Nueva123\"",
    "email": "\"juan@empresa.com\"",
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": [],
    "status": "ok",
    "message": "Contrasena restablecida correctamente.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "token": [
                "Token invalido."
            ]
        }
    },
    "status": "error",
    "message": "Validacion fallida.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

POST api/auth/password/reset

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

id   string     

Must not be greater than 1000 characters. Example: yknji

token   string     

Token de recuperacion recibido por correo. Example: "abc123"

password   string     

Nueva contrasena. Example: "Nueva123"

password_confirmation   string     

Confirmacion de la nueva contrasena. Example: "Nueva123"

email   string     

Correo del usuario. Example: "juan@empresa.com"

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Datos del usuario autenticado

requires authentication

Devuelve la informacion del usuario autenticado (y opcionalmente la URL de foto).

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/auth/getRequestUserData';
$response = $client->get(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'query' => [
            'include' => '"pic_url"',
        ],
        'json' => [
            'include' => 'pic_url',
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/auth/getRequestUserData"
);

const params = {
    "include": ""pic_url"",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "include": "pic_url",
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "GET",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id": 15,
        "name": "Juan Perez",
        "email": "juan@empresa.com",
        "pic_url": "https://app.test/storage/users/15.png"
    },
    "status": "ok",
    "message": "",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Request   

GET api/auth/getRequestUserData

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Query Parameters

include   string  optional    

Incluir info extra, por ahora pic_url. Example: "pic_url"

Body Parameters

include   string  optional    

Example: pic_url

Must be one of:
  • pic_url
id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Refrescar token

requires authentication

Genera un nuevo token para el usuario autenticado.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/auth/refreshUserToken';
$response = $client->get(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/auth/refreshUserToken"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "GET",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."
    },
    "status": "ok",
    "message": "Token refrescado.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Request   

GET api/auth/refreshUserToken

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Logout

requires authentication

Revoca el token del usuario autenticado.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/auth/logout';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/auth/logout"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "DELETE",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": [],
    "status": "ok",
    "message": "Logout exitoso.",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Request   

DELETE api/auth/logout

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Content-Type        

Example: application/json

Body Parameters

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Telegram

Enviar mensaje por Telegram

requires authentication

Envia un mensaje a un chat de Telegram usando el bot configurado.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/telegram/sendTelegramMessage';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Authorization' => 'string required Bearer token (auth:sanctum).',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'bot_token' => '"12345:ABC"',
            'id_chat' => '"123456789"',
            'message' => '"Hola desde la API"',
            'id_user' => 7,
            'name_user' => '"Agente 1"',
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/telegram/sendTelegramMessage"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Authorization": "string required Bearer token (auth:sanctum).",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "bot_token": "\"12345:ABC\"",
    "id_chat": "\"123456789\"",
    "message": "\"Hola desde la API\"",
    "id_user": 7,
    "name_user": "\"Agente 1\"",
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "status": "ok",
    "message": "Mensaje enviado",
    "data": {
        "id_chat": "123456789",
        "message": "Hola desde la API"
    },
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "id_chat": [
                "El campo id_chat es obligatorio."
            ]
        }
    },
    "status": "error",
    "message": "Validacion fallida.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

POST api/telegram/sendTelegramMessage

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Authorization        

Example: string required Bearer token (auth:sanctum).

Content-Type        

Example: application/json

Body Parameters

bot_token   string  optional    

Token del bot (si no se toma de config). Example: "12345:ABC"

id_chat   string     

Identificador del chat destino. Example: "123456789"

message   string     

Contenido del mensaje. Example: "Hola desde la API"

id_user   integer     

Id del usuario emisor en el sistema. Example: 7

name_user   string     

Nombre del usuario emisor. Example: "Agente 1"

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Leer mensajes pendientes de Telegram

requires authentication

Obtiene mensajes pendientes del bot.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/telegram/readTelegramMessages';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Authorization' => 'string required Bearer token (auth:sanctum).',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'bot_token' => '"12345:ABC"',
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/telegram/readTelegramMessages"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Authorization": "string required Bearer token (auth:sanctum).",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "bot_token": "\"12345:ABC\"",
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "status": "ok",
    "message": "Mensajes leidos",
    "data": [
        {
            "id_chat": "123456789",
            "message": "Hola"
        }
    ],
    "code": 200,
    "id_bitacora_log": 736014
}
 

Request   

POST api/telegram/readTelegramMessages

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Authorization        

Example: string required Bearer token (auth:sanctum).

Content-Type        

Example: application/json

Body Parameters

bot_token   string  optional    

Token del bot (si no se toma de config). Example: "12345:ABC"

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Configurar webhook de Telegram

requires authentication

Registra el webhook del bot apuntando al endpoint de recepcion.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/telegram/setWebhook';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-User-Consumo' => 'string required Identificador del cliente de consumo (middleware auth.api_client).',
            'X-User-Secret' => 'string required Secreto del cliente de consumo.',
            'Authorization' => 'string required Bearer token (auth:sanctum).',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'bot_token' => '"12345:ABC"',
            'company' => '3',
            'name' => '"Bot soporte"',
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/telegram/setWebhook"
);

const headers = {
    "X-User-Consumo": "string required Identificador del cliente de consumo (middleware auth.api_client).",
    "X-User-Secret": "string required Secreto del cliente de consumo.",
    "Authorization": "string required Bearer token (auth:sanctum).",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "bot_token": "\"12345:ABC\"",
    "company": "3",
    "name": "\"Bot soporte\"",
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "status": "ok",
    "message": "Webhook configurado",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "bot_token": [
                "El campo bot_token es requerido."
            ]
        }
    },
    "status": "error",
    "message": "Validacion fallida.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

POST api/telegram/setWebhook

Headers

X-User-Consumo        

Example: string required Identificador del cliente de consumo (middleware auth.api_client).

X-User-Secret        

Example: string required Secreto del cliente de consumo.

Authorization        

Example: string required Bearer token (auth:sanctum).

Content-Type        

Example: application/json

Body Parameters

bot_token   string     

Token del bot. Example: "12345:ABC"

company   numeric     

Id de la empresa. Example: 3

name   string     

Nombre de referencia. Example: "Bot soporte"

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora (se agrega automaticamente en middleware). Example: 736014

Webhook de recepcion de Telegram

Punto de entrada publico que recibe actualizaciones desde Telegram.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/telegram/receive/"bot-123"';
$response = $client->post($url);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/telegram/receive/"bot-123""
);

fetch(url, {
    method: "POST",
}).then(response => response.json());

Example response (200):


{
    "status": "ok"
}
 

Request   

POST api/telegram/receive/{idChannel}

URL Parameters

idChannel   string     

Identificador del canal configurado. Example: "bot-123"

Obtener archivo multimedia de Telegram

Devuelve el archivo almacenado de Telegram.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://calidad.api.atencionprofesional.com/api/telegram/getMediaFile';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
        ],
        'query' => [
            'filename' => '"photo_12345.jpg"',
        ],
        'json' => [
            'filename' => 'pariatur',
            'id_bitacora_log' => 736014,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://calidad.api.atencionprofesional.com/api/telegram/getMediaFile"
);

const params = {
    "filename": ""photo_12345.jpg"",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "filename": "pariatur",
    "id_bitacora_log": 736014
};

fetch(url, {
    method: "GET",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "status": "ok",
    "message": "",
    "code": 200,
    "id_bitacora_log": 736014
}
 

Example response (422):


{
    "data": {
        "errors": {
            "filename": [
                "El campo filename es requerido."
            ]
        }
    },
    "status": "error",
    "message": "Validacion fallida.",
    "code": 422,
    "id_bitacora_log": 736014
}
 

Request   

GET api/telegram/getMediaFile

Headers

Content-Type        

Example: application/json

Query Parameters

filename   string     

Nombre del archivo a recuperar. Example: "photo_12345.jpg"

Body Parameters

filename   string     

Example: pariatur

id_bitacora_log   integer  optional    

ID opcional para enlazar la bitacora. Example: 736014