### GET /api/customers Source: https://helpcenter.konverting.io/Developers/Customers Retrieves a list of customers. You can filter customers by providing their `id` as a query parameter. ```APIDOC ## GET /api/customers ### Description Retrieves a list of customers. You can filter customers by providing their `id` as a query parameter. ### Method GET ### Endpoint `https://app.konverting.io/api/customers` ### Parameters #### Headers - **apikey** (string) - Required - The authentication token. - **Content-Type** (string) - Required - Should be `application/json`. #### Query Parameters - **id** (string) - Optional - The identifier of the customer to retrieve. ### Request Example (No request body for GET requests, use query parameters if needed) ### Response #### Success Response (200 OK) Returns a list of customer objects matching the query. If an `id` is provided, it returns the specific customer. #### Response Example (200 OK) ```json [ { "id": "{{internalId}}", "publicId": "{{publicId}}", "rank": 0, "name": null, "phone": "{{phone}}", "email": null, "company": null, "country": null, "zipcode": null, "address": null, "externalCRM": null, "attributes": "[\"key\":\"pack\",\"value\":\"prueba\"]", "createdAt": "{{dateTime}}", "updatedAt": "{{dateTime}}", "idAccount": "{{idAccount}}" } ] ``` #### Error Response (400 Bad Request) - **error** (String) - Description of the error, e.g., "No valid apiKey" or "Invalid customer ID". #### Response Example (400 Bad Request) ```json { "error": "No valid apiKey" } ``` ``` -------------------------------- ### POST /api/customers Source: https://helpcenter.konverting.io/Developers/Customers Creates a new customer in the system. Customer data is sent in JSON format and must include `idAccount`, `publicId`, `phone`, and `attributes`. ```APIDOC ## POST /api/customers ### Description Creates a new customer in the system. Customer data is sent in JSON format and must include `idAccount`, `publicId`, `phone`, and `attributes` which describe additional customer data. The customer will be created in the associated account. ### Method POST ### Endpoint `https://app.konverting.io/api/customers` ### Parameters #### Headers - **apikey** (string) - Required - The authentication token. - **Content-Type** (string) - Required - Should be `application/json`. #### Request Body - **idAccount** (string) - Required - The identifier of the user account. - **publicId** (string) - Required - A public identifier for the customer. - **phone** (string) - Required - The customer's phone number. - **attributes** (array of objects) - Optional - An array of custom attributes associated with the customer. - **key** (string) - Required - The name of the attribute. - **value** (string) - Required - The value of the attribute. ### Request Example ```json { "idAccount": "{{idAcoount}}", "publicId": "{{publicId}}", "phone": "{{phone}}", "attributes": [ { "key": "pack", "value": "prueba" } ] } ``` ### Response #### Success Response (200 OK) - **id** (String) - Unique identifier of the customer. - **publicId** (String) - Public identifier of the customer. - **rank** (Integer) - Customer rank within the system. - **name** (String) - Customer name (can be null). - **phone** (String) - Customer phone number. - **email** (String) - Customer email (can be null). - **company** (String) - Customer company name (can be null). - **country** (String) - Customer country (can be null). - **zipcode** (String) - Customer postal code (can be null). - **address** (String) - Customer address (can be null). - **externalCRM** (String) - External CRM identifier (can be null). - **attributes** (Array) - Custom attributes associated with the customer. - **createdAt** (Date) - Date the record was created. - **updatedAt** (Date) - Date the record was last updated. - **idAccount** (String) - Identifier of the associated account. #### Response Example (200 OK) ```json { "id": "{{internalId}}", "publicId": "{{publicId}}", "rank": 0, "name": null, "phone": "{{phone}}", "email": null, "company": null, "country": null, "zipcode": null, "address": null, "externalCRM": null, "attributes": "[\"key\":\"pack\",\"value\":\"prueba\"]", "createdAt": "{{dateTime}}", "updatedAt": "{{dateTime}}", "idAccount": "{{idAccount}}" } ``` #### Error Response (400 Bad Request) - **error** (String) - Description of the error, e.g., "No valid apiKey". #### Response Example (400 Bad Request) ```json { "error": "No valid apiKey" } ``` > **Note**: Ensure all required fields are present and correctly formatted to avoid malformed request errors. ``` -------------------------------- ### Programar Campaña con Plantilla y Valores Asignados (API) Source: https://helpcenter.konverting.io/Developers/ScheduleMessage Este snippet muestra cómo programar el envío de una plantilla a un segmento de clientes, asignando valores específicos a las variables de la plantilla. Requiere un apikey y especifica el cuerpo de la solicitud en formato JSON. ```HTTP POST https://app.konverting.io/api/Templates/schedule Headers: apikey: {{token}} Content-Type: application/json Body: { "idAccount": "{{idAccount}}", "templateId": "{{templateId}}", "customers":[{"key":"pack","value":"prueba"}], "assignValues": [ { "key": "{{1}}", "value": "parametro1" }, { "key": "{{2}}", "value": "parametro2" }, { "key": "{{3}}", "value": "parametro3" }, { "key": "{{4}}", "value": "parametro4" } ], "schedule": "2024-01-01 14:30", "idflow": "{{idflow}}" } ``` -------------------------------- ### Create Customer - API Request Source: https://helpcenter.konverting.io/Developers/Customers This snippet demonstrates how to create a new customer using the Konverting.io API. It requires an API key in the headers and a JSON payload containing customer details like idAccount, publicId, phone, and attributes. The API returns a 200 OK status on success or a 400 Bad Request on failure. ```http POST https://app.konverting.io/api/customers Headers: apikey: {{token}} Content-Type: application/json Body: { "idAccount":"{{idAcoount}}", "publicId":"{{publicId}}", "phone":"{{phone}}", "attributes":[{"key":"pack","value":"prueba"}] } ``` -------------------------------- ### Create Customer - API Response (Success) Source: https://helpcenter.konverting.io/Developers/Customers This snippet shows a successful API response when creating a customer. It returns a JSON object with the newly created customer's details, including their internal ID, public ID, phone number, attributes, and account information. The response includes timestamps for creation and update. ```json { "id": "{{internalId}}", "publicId": "{{publicId}}", "rank": 0, "name": null, "phone": "{{phone}}", "email": null, "company": null, "country": null, "zipcode": null, "address": null, "externalCRM": null, "attributes": "[{\"key\": \"pack\", \"value\": \"prueba\"}]", "createdAt": "{{dateTime}}", "updatedAt": "{{dateTime}}", "idAccount": "{{idAccount}}" } ``` -------------------------------- ### POST /api/Templates/schedule Source: https://helpcenter.konverting.io/Developers/ScheduleMessage This endpoint allows sending a template with assigned values to a customer segment and scheduling its execution. ```APIDOC ## POST /api/Templates/schedule ### Description This endpoint allows sending a template with assigned values to a customer segment and scheduling its execution. ### Method POST ### Endpoint https://app.konverting.io/api/Templates/schedule ### Parameters #### Headers - **apikey** (string) - Required - The authentication token. - **Content-Type** (string) - Required - Must be `application/json`. #### Request Body - **idAccount** (string) - Required - The user account identifier. - Example: `"DEMO"` - **templateId** (string) - Required - The identifier of the template. - Example: `"Bienvenida"` - **customers** (array of objects) - Required - Segment of the customer database in your Konverting account. - Example: `[{"pack":"prueba"}]` - **assignValues** (array of objects) - Optional - An array of values if the template has variables. - Example: `[{"key": "{{1}}","value": "parametro1"}]` - **schedule** (string) - Required - The date and time to schedule the campaign execution in `YYYY-MM-DD HH:MM` format. - Example: `"2024-01-01 14:30"` - **idflow** (string) - Required - The flow identifier. ### Request Example ```json { "idAccount": "{{idAccount}}", "templateId": "{{templateId}}", "customers":[{"key":"pack","value":"prueba"}], "assignValues": [ { "key": "{{1}}", "value": "parametro1" }, { "key": "{{2}}", "value": "parametro2" }, { "key": "{{3}}", "value": "parametro3" }, { "key": "{{4}}", "value": "parametro4" } ], "schedule": "2024-01-01 14:30", "idflow": "{{idflow}}" } ``` ### Response #### Success Response (200 OK) - **message** (string) - Indicates that the request was successful and the resource has been processed correctly. #### Response Example ```json { "message": "Campaign scheduled successfully." } ``` #### Error Responses - **400 Bad Request**: The request is malformed or there is no valid `token`. ``` -------------------------------- ### Create Customer - API Response (Error) Source: https://helpcenter.konverting.io/Developers/Customers This snippet illustrates an error response from the API when attempting to create a customer with an invalid or missing API key. It returns a 400 Bad Request status with a JSON body indicating the error, such as 'No valid apiKey'. ```json { "error": "No valid apiKey" } ``` -------------------------------- ### Read Customer - API Request Source: https://helpcenter.konverting.io/Developers/Customers This snippet shows how to retrieve customer information using the Konverting.io API. It requires an API key in the headers and a JSON payload containing the customer's ID. The API is expected to return customer details upon successful retrieval. ```http GET https://app.konverting.io/api/customers Headers: apikey: {{token}} Content-Type: application/json Body: { "id":"{{customerId}}" } ``` -------------------------------- ### Session Token Authentication Source: https://helpcenter.konverting.io/Developers/Auth Obtain a temporary session token by providing your username and password. This token is valid for 48 hours and is required for subsequent API operations. ```APIDOC ## POST api/login ### Description Authenticates a user and returns a session token valid for 48 hours. ### Method POST ### Endpoint `https://app.konverting.io/api/login` ### Parameters #### Request Body - **email** (string) - Required - The user's email address. - **password** (string) - Required - The user's password. ### Request Example ```json { "email": "usuario@dominio.com", "password": "contraseña" } ``` ### Response #### Success Response (200) - **id** (string) - The user's unique identifier. - **username** (string) - The authenticated user's email. - **token** (string) - The session token for subsequent requests. - **name** (string) - The user's full name. - **avatar** (string) - URL to the user's avatar image. - **role** (string) - The user's role within the platform. - **RGPD** (boolean) - Indicates compliance with RGPD regulations. #### Response Example ```json { "id": "{{USER_ID}}", "username": "JohnDoe@gmail.com", "token": "{{TOKEN}}", "name": "John Doe", "avatar": "", "role": "Manager", "RGPD": true } ``` #### Error Response (401) ```json { "error": "No Access" } ``` #### Error Response (400) ```json { "error": "No data" } ``` #### Error Response (500) ```json { "error": "Error al realizar la peticion" } ``` ``` -------------------------------- ### Send Message API Request (cURL) Source: https://helpcenter.konverting.io/Developers/Interactions This cURL command illustrates how to send a POST request to the 'Send Message' API endpoint. It includes the necessary headers, such as 'apikey' and 'Content-Type', and the JSON payload for sending a message. Replace `{{token}}`, `{{idAccount}}`, `{{uid}}`, and `{{text}}` with your specific values. ```bash curl -X POST https://app.konverting.io/api/session/send_message \ -H "apikey: {{token}}" \ -H "Content-Type: application/json" \ -d '{ "idAccount": "{{idAccount}}", "uid": "{{uid}}", "message": "{{text}}" }' ``` -------------------------------- ### POST /api/session/send_message Source: https://helpcenter.konverting.io/Developers/Interactions Sends a live message to a client with whom you have an active interaction. ```APIDOC ## POST /api/session/send_message ### Description Sends a live message to a client with whom you have an active interaction. ### Method POST ### Endpoint https://app.konverting.io/api/session/send_message ### Headers - **apikey** (string) - Required - Your API token. - **Content-Type** (string) - Required - `application/json` ### Request Body - **idAccount** (string) - Required - The user account identifier. - Example: `"DEMO"` - **uid** (string) - Required - The client session identifier. - Example: `"{{uid}}"` - **message** (string) - Required - The message content. - Example: `"Bienvenida"` ### Request Example ```json { "idAccount": "{{idAccount}}", "uid": "{{uid}}", "message": "{{text}}" } ``` ### Response #### Success Response (200 OK) - The request was successful and the resource has been processed correctly. #### Error Response (400 Bad Request) - The request is malformed or there is no correct `token`. #### Response Example ```json { "status": "success", "message": "Message sent successfully" } ``` ``` -------------------------------- ### Send Message API Request (JSON) Source: https://helpcenter.konverting.io/Developers/Interactions This snippet demonstrates how to construct a JSON request body for the 'Send Message' API endpoint. It includes the necessary parameters: idAccount, uid, and message. Ensure you replace the placeholder values with your actual account ID, user ID, and message content. ```json { "idAccount": "{{idAccount}}", "uid": "{{uid}}", "message": "{{text}}" } ``` -------------------------------- ### Account Token Authentication Source: https://helpcenter.konverting.io/Developers/Auth Use an account token for persistent authentication. These tokens do not expire and can be generated or revoked from your Konverting account settings. The format is typically `pat-konverting-xxxxxxxx`. ```APIDOC ## Account Token Authentication ### Description Account tokens provide non-expiring authentication for API access. They can be managed within your Konverting account settings. ### Method Not Applicable (Token is used in headers) ### Endpoint Not Applicable (Token is used in headers) ### Parameters #### Request Headers - **apikey** (string) - Required - Your account token (e.g., `pat-konverting-xxxxxxxx`). ### Request Example ```bash curl -X GET "https://app.konverting.io/api/some_endpoint" \ -H "apikey: pat-konverting-xxxxxxxx" \ -H "Content-Type: application/json" ``` ### Response *Responses will vary based on the endpoint being accessed.* ``` -------------------------------- ### POST /api/flows/{id} Source: https://helpcenter.konverting.io/Developers/Flows Retrieves interaction flow data for a given flow ID. Requires an API key for authentication. ```APIDOC ## POST /api/flows/{id} ### Description Retrieves interaction flow data for a given flow ID. Requires an API key for authentication. ### Method POST ### Endpoint /api/flows/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The identifier of the interaction flow. #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200 OK) - The request was successful and the resource has been processed correctly. #### Error Response - **400 Bad Request**: The request is malformed or there is no correct token. #### Response Example None ``` -------------------------------- ### POST /api/Templates/send Source: https://helpcenter.konverting.io/Developers/SendTemplate Sends a predefined message to a client. This is useful for initiating communication or sending automated messages when no active interaction exists. ```APIDOC ## POST /api/Templates/send ### Description Sends a predefined message to a client. This is useful for initiating communication or sending automated messages when no active interaction exists. ### Method POST ### Endpoint https://app.konverting.io/api/Templates/send ### Parameters #### Header Parameters - **apikey** (string) - Required - The API token for authentication. - **Content-Type** (string) - Required - Must be `application/json`. #### Request Body - **idAccount** (string) - Required - The identifier of the user account. - Example: `"DEMO"` - **phone** (string) - Required - The client's phone number. - Example: `"34999999999"` - **templateId** (string) - Required - The identifier of the template to be used. - Example: `"Bienvenida"` - **values** (array of strings) - Optional - An array of values to populate template variables. - Example: `["valor1","valor2"]` ### Request Example ```json { "idAccount": "{{idAccount}}", "phone": "{{phone}}", "templateId": "{{templateId}}", "values": [] } ``` ### Response #### Success Response (200 OK) - **id** (string) - The unique identifier of the sent message. - **publicId** (string) - The public identifier, often the phone number. - **status** (string) - The status of the message sending operation. #### Response Example ```json { "id": "{{id}}", "publicId": "{{phone}}", "status": "{{status}}" } ``` #### Error Response (400 Bad Request) - Indicates a malformed request or an invalid API token. ``` -------------------------------- ### Obtain Session Token using cURL Source: https://helpcenter.konverting.io/Developers/Auth This snippet demonstrates how to authenticate with the Konverting.io API to obtain a session token using cURL. It requires a username and password, and the response includes the user's token and other details. The session token is valid for 48 hours. ```curl curl -X POST "https://app.konverting.io/api/login" -H "Content-Type: application/json" -d '{"username": "user", "password": "pass"}' ``` -------------------------------- ### API Session Token Request Body Source: https://helpcenter.konverting.io/Developers/Auth This is the raw JSON body required for the API request to obtain a session token. It includes the user's email (username) and password for authentication. ```json { "email": "usuario@dominio.com", "password": "contraseña" } ``` -------------------------------- ### API Session Token Successful Response (200) Source: https://helpcenter.konverting.io/Developers/Auth This JSON object represents a successful API response (HTTP 200) after obtaining a session token. It contains the user's ID, username, the generated token, name, avatar, role, and RGPD status. ```json { "id": "{{USER_ID}}", "username": "JohnDoe@gmail.com", "token": "{{TOKEN}}", "name": "John Doe", "avatar": "", "role": "Manager", "RGPD": true } ``` -------------------------------- ### API Session Token Error Responses Source: https://helpcenter.konverting.io/Developers/Auth These JSON objects represent potential error responses from the API when attempting to obtain a session token. They include 'No Access' (401), 'No data' (400), and a generic 'Error' (500). ```json { "error": "No Access"" } ``` ```json { "error": "No data"" } ``` ```json { "error": "Error al realizar la peticion" } ``` -------------------------------- ### Send Template API Request Body (JSON) Source: https://helpcenter.konverting.io/Developers/SendTemplate This JSON object represents the raw body of the POST request to the Send Template API. It includes account ID, phone number, template ID, and an array for template values. ```json { "idAccount": "{{idAccount}}", "phone": "{{phone}}", "templateId": "{{templateId}}", "values": [] } ``` -------------------------------- ### Send Template API Success Response (JSON) Source: https://helpcenter.konverting.io/Developers/SendTemplate This JSON object represents a successful response (200 OK) from the Send Template API. It contains the message ID, public ID (phone number), and the status of the operation. ```json { "id": "{{id}}", "publicId": "{{phone}}", "status": "{{status}}" } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.