### Authentication Header Example Source: https://docs.qontak.com/docs/omnichannel-hub/50e85232fb795-authentication This snippet demonstrates how to include the necessary Authorization header in your API requests. It uses a Bearer token for authentication. Ensure you replace `${ACCESS_TOKEN}` with your actual access token. ```shell curl --request GET \ --url {{BaseUrl}}/v1/health \ --header 'Authorization: Bearer ${ACCESS_TOKEN}' ``` -------------------------------- ### Token Refresh Request Example Source: https://docs.qontak.com/docs/omnichannel-hub/50e85232fb795-authentication This example shows the JSON body required to refresh your access token. It includes your `refresh_token`, `grant_type`, `client_id`, and `client_secret`. The `client_id` and `client_secret` should not be modified. ```json { "refresh_token": "", "grant_type": "refresh_token", "client_id": "RRrn6uIxalR_QaHFlcKOqbjHMG63elEdPTair9B9YdY", "client_secret": "Sa8IGIh_HpVK1ZLAF0iFf7jU760osaUNV659pBIZR00" } ``` -------------------------------- ### Status Embed Installation Source: https://docs.qontak.com/docs/omnichannel-hub/YXBpOjQ3Mjk1MDI2-qontak-open-api-v1-0-1 Information regarding the installation of the status embed, which displays incidents or maintenance notices from your status page. ```APIDOC ## Status Embed Installation ### Description This section explains how to correctly install the status embed. Once installed, it will display any ongoing incidents or scheduled maintenance that have been posted on your status page, providing real-time updates to users. ### Usage Ensure JavaScript is enabled for proper website accessibility and functionality of the status embed. ``` -------------------------------- ### Authentication API Source: https://docs.qontak.com/docs/omnichannel-hub/50e85232fb795-authentication This section details how to authenticate API requests using access tokens and how to refresh them. ```APIDOC ## Authentication API ### Description API requests require authentication using access tokens. You can obtain these tokens from your Qontak Omnichannel Account. There are two types of tokens: User access tokens for sending WhatsApp HSM templates and Bot tokens for Chatbot interactions. ### Method GET ### Endpoint {{BaseUrl}}/v1/health ### Parameters #### Headers - **Authorization** (string) - Required - `Bearer ${ACCESS_TOKEN}` ### Request Example ```shell curl --request GET \ --url {{BaseUrl}}/v1/health \ --header 'Authorization: Bearer ${ACCESS_TOKEN}' ``` ### Response #### Success Response (200) - **status** (string) - Indicates the health status of the service. #### Response Example ```json { "status": "ok" } ``` ## Refresh Token ### Description This endpoint allows you to refresh your access token using a valid refresh token and your Qontak account credentials. ### Method POST ### Endpoint `https://service-chat.qontak.com/oauth/token` ### Parameters #### Request Body - **refresh_token** (string) - Required - Your existing refresh token. - **grant_type** (string) - Required - Must be set to `refresh_token`. - **client_id** (string) - Required - Your application's client ID. - **client_secret** (string) - Required - Your application's client secret. ### Request Example ```json { "refresh_token": "", "grant_type": "refresh_token", "client_id": "RRrn6uIxalR_QaHFlcKOqbjHMG63elEdPTair9B9YdY", "client_secret": "Sa8IGIh_HpVK1ZLAF0iFf7jU760osaUNV659pBIZR00" } ``` ### Response #### Success Response (200) - **access_token** (string) - The new access token. - **token_type** (string) - The type of token, usually "Bearer". - **expires_in** (integer) - The token's lifespan in seconds. - **refresh_token** (string) - The new refresh token. - **created_at** (integer) - The timestamp when the token was created. #### Response Example ```json { "access_token": "WPuW1u-v21SkfqfC7NNBD9NvNg3ojy8ftuUpVy3ArbU", "token_type": "Bearer", "expires_in": 29823918, "refresh_token": "UU_3xp5jRN0fsNKDrVAEh4QqdRody3Wc37VQHFZ37C4", "created_at": 1594354514 } ``` ``` -------------------------------- ### Example JSON for Broadcast Log Status Event Source: https://docs.qontak.com/docs/omnichannel-hub/1d2a6557d37a8-message-interaction-webhooks This JSON structure shows the example response for the `broadcast_log_status` webhook event. It provides details about the broadcast, associated contacts, message status, and any relevant WhatsApp message IDs or error messages. ```json { "id": "string", "organization_id": "string", "messages_broadcast_id": "string", "messages_broadcast_template_id": "string", "contact_phone_number": "string", "contact_full_name": "string", "status": "string", "whatsapp_message_id": "string", "whatsapp_error_message": "string", "messages_response": { "read": { "statuses": [ { "id": "string", "recipient_id": "string", "status": "string", "timestamp": "integer" } ], "webhook": "string" }, "contacts": [ { "input": "string", "wa_id": "string" } ], "messages": [ { "id": "string", "message_status": "string" } ], "delivered": { "webhook": "string", "statuses": [ { "id": "string", "status": "string", "pricing": { "billable": "boolean", "category": "string", "pricing_model": "string" }, "timestamp": "integer", "conversation": { "id": "string", "origin": { "type": "string" } }, "recipient_id": "string" } ] }, "messaging_product": "string" }, "messages": { "body": { "type": "string", "template": "string", "parameters": "array" }, "header": { "type": "string", "template": "object", "parameters": "array" }, "buttons": { "type": "string", "template": "null", "parameters": "array" } }, "created_at": "datetime", "is_pacing": "boolean", "data_event": "string", "webhook_event": "string" } ``` -------------------------------- ### Example JSON for Message Events (Customer/Agent/Status) Source: https://docs.qontak.com/docs/omnichannel-hub/1d2a6557d37a8-message-interaction-webhooks This JSON structure represents the example response for webhook events such as `receive_message_from_customer`, `receive_message_from_agent`, and `status_message`. It details information about the message, sender, participant, and the associated room. ```json { "id": "string", "type": "string", "room_id": "string", "is_campaign": "boolean", "sender_id": "string", "sender_type": "string", "sender": { "name": "string", "avatar": { "url": "string", "large": { "url": "string" }, "medium": { "url": "string" }, "small": { "url": "string" }, "filename": "string|null", "size": "integer" } }, "participant_id": "string", "organization_id": "string", "text": "string", "status": "string", "participant_type": "string", "external_id": "string", "local_id": "string|null", "created_at": "datetime", "reply": "string|null", "room": { "id": "string", "name": "string", "description": "string", "status": "string", "type": "string", "tags": "array", "channel": "string", "channel_account": "string", "organization_id": "string", "account_uniq_id": "string", "channel_integration_id": "string", "session": "string", "session_at": "datetime", "unread_count": "integer", "created_at": "datetime", "updated_at": "datetime", "avatar": "string|null", "resolved_at": "datetime|null", "external_id": "string|null", "resolved_by_id": "string|null", "resolved_by_type": "string|null" } } ``` -------------------------------- ### GET /api/open/v1/integrations - Get available WhatsApp channels Source: https://docs.qontak.com/docs/omnichannel-hub/e704aba31cb4b-whats-app-outbound-message-bulk Retrieve a list of available WhatsApp channel integrations. This endpoint helps in identifying available channels and their configurations. ```APIDOC ## GET /api/open/v1/integrations ### Description Retrieve a list of available WhatsApp channel integrations. This endpoint helps in identifying available channels and their configurations. ### Method GET ### Endpoint `https://service-chat.qontak.com/api/open/v1/integrations` ### Parameters #### Query Parameters - **target_channel** (string) - Required - Specifies the channel to retrieve, e.g., 'wa' for WhatsApp. - **Authorization** (string) - Required - Bearer token for authentication. ### Request Example ```shell curl -X GET https://service-chat.qontak.com/api/open/v1/integrations?target_channel=wa \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ### Response #### Success Response (200) - **status** (string) - The status of the response, e.g., 'success'. - **data** (array) - An array of channel integration objects. - **id** (string) - The unique identifier for the channel integration. - **target_channel** (string) - The type of channel (e.g., 'wa'). - **webhook** (string) - The webhook URL configured for the channel. - **settings** (object) - Settings specific to the channel integration. - **domain_server** (string) - The domain server for the channel. - **authorization** (string) - Authorization details for the channel. - **account_name** (string) - The account name associated with the channel. - **server_wa_id** (string) - The WhatsApp server ID. - **organization_id** (string) - The ID of the organization. - **created_at** (string) - Timestamp when the integration was created. - **meta** (object) - Metadata for pagination. - **pagination** (object) - Pagination details. - **cursor** (object) - Cursor information for next and previous pages. - **offset** (integer) - The current offset. - **limit** (integer) - The limit of items per page. - **total** (integer) - The total number of available items. #### Response Example ```json { "status": "success", "data": [ { "id": "c3370195-3451-4645-99a1-578c47b24d41", "target_channel": "wa", "webhook": "LswudlTUZRpJErf-kqHB2A", "settings": { "domain_server": "https://api-whatsapp.qontak.net", "authorization": "Y7Rt3W43VGVyhmFuZzgyM4E=", "account_name": "Qontak", "server_wa_id": "6288233262100" }, "organization_id": "7e6e0187-6707-464f-8b99-59b094caae0b", "created_at": "2020-07-28T02:43:30.060+00:00" } ], "meta": { "pagination": { "cursor": { "next": "MTU5NTUwOTI3Ny4yNDY=", "prev": "MTU5NTkwNDIxMC4wNg==" }, "offset": 1, "limit": 4, "total": 4 } } } ``` ``` -------------------------------- ### GET /api/open/v1/templates/whatsapp - Get available WhatsApp message templates Source: https://docs.qontak.com/docs/omnichannel-hub/e704aba31cb4b-whats-app-outbound-message-bulk Retrieve a list of all approved WhatsApp message templates associated with your account. This is necessary before sending notification messages. ```APIDOC ## GET /api/open/v1/templates/whatsapp ### Description Retrieve a list of all approved WhatsApp message templates associated with your account. This is necessary before sending notification messages. ### Method GET ### Endpoint `https://service-chat.qontak.com/api/open/v1/templates/whatsapp` ### Parameters #### Query Parameters - **Authorization** (string) - Required - Bearer token for authentication. ### Request Example ```shell curl -X GET https://service-chat.qontak.com/api/open/v1/templates/whatsapp \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ### Response #### Success Response (200) - **status** (string) - The status of the response, e.g., 'success'. - **data** (array) - An array of WhatsApp message template objects. - **id** (string) - The unique identifier for the message template. - **name** (string) - The name of the message template. - **language** (string) - The language code of the template (e.g., 'id'). - **header** (object|null) - Header content of the template. - **body** (string) - The body content of the template, may contain placeholders like {{1}}. - **footer** (object|null) - Footer content of the template. - **status** (string) - The approval status of the template (e.g., 'APPROVED'). - **category** (string) - The category of the template (e.g., 'PAYMENT_UPDATE'). - **meta** (object) - Metadata for pagination. - **pagination** (object) - Pagination details. - **cursor** (object) - Cursor information for next and previous pages. - **offset** (integer) - The current offset. - **limit** (integer) - The limit of items per page. - **total** (integer) - The total number of available items. #### Response Example ```json { "status": "success", "data": [ { "id": "cf7a16bd-e84f-4f72-8cce-70934edfc585", "name": "message", "language": "id", "header": null, "body": "Hi {{1}}, Silakan periksa invoice di email anda.", "footer": null, "status": "APPROVED", "category": "PAYMENT_UPDATE" } ], "meta": { "pagination": { "cursor": { "next": "MTU5MTI1OTg5OC45NzQwMDAy", "prev": "MTU5NTkwODgwNy4yNjQ5OTk5" }, "offset": 1, "limit": 48, "total": 48 } } } ``` ``` -------------------------------- ### Qontak Open API Base URL Source: https://docs.qontak.com/docs/omnichannel-hub/YXBpOjQ3Mjk1MDI2-qontak-open-api-v1-0-1 The base URL for the Qontak Open API v1.0.1. The `postfix` parameter is used to get the Token only. ```APIDOC ## API Base URL ### Description The base URL for the Qontak Open API v1.0.1. The `postfix` parameter determines the specific endpoint, with `/api/open` being the default for general use and also for obtaining tokens. ### Endpoint `https://service-chat.qontak.com{postfix}` ### Parameters #### Path Parameters - **postfix** (string) - Required - Used to specify the API endpoint. Allowed values include `/api/open` for token retrieval and general use. ``` -------------------------------- ### Message Interaction Events Source: https://docs.qontak.com/docs/omnichannel-hub/1d2a6557d37a8-message-interaction-webhooks Provides example response structures for various message interaction events, including messages from customers, agents, and status updates. ```APIDOC ## Message Interaction Events ### Description This section details the example response payloads for different message interaction events. These events are crucial for understanding the flow of messages within the Qontak platform. ### Events Covered - `receive_message_from_customer` - `receive_message_from_agent` - `status_message` ### Response Example for `receive_message_from_customer`, `receive_message_from_agent`, and `status_message` Events ```json { "id": "string", "type": "string", "room_id": "string", "is_campaign": "boolean", "sender_id": "string", "sender_type": "string", "sender": { "name": "string", "avatar": { "url": "string", "large": { "url": "string" }, "medium": { "url": "string" }, "small": { "url": "string" }, "filename": "string|null", "size": "integer" } }, "participant_id": "string", "organization_id": "string", "text": "string", "status": "string", "participant_type": "string", "external_id": "string", "local_id": "string|null", "created_at": "datetime", "reply": "string|null", "room": { "id": "string", "name": "string", "description": "string", "status": "string", "type": "string", "tags": "array", "channel": "string", "channel_account": "string", "organization_id": "string", "account_uniq_id": "string", "channel_integration_id": "string", "session": "string", "session_at": "datetime", "unread_count": "integer", "created_at": "datetime", "updated_at": "datetime", "avatar": "string|null", "resolved_at": "datetime|null", "external_id": "string|null", "resolved_by_id": "string|null", "resolved_by_type": "string|null" } } ``` ``` -------------------------------- ### Qontak API Environment Variables Setup Source: https://docs.qontak.com/docs/omnichannel-hub/3f11066e2ce6c-api-mekari-v1-0 This snippet shows how to configure environment variables for Qontak API integration. It outlines the necessary variables to store your API client ID, client secret, and the base URL for API requests. ```env MEKARI_API_CLIENT_ID=YOUR_MEKARI_API_CLIENT_ID MEKARI_API_CLIENT_SECRET=YOUR_MEKARI_API_CLIENT_SECRET MEKARI_API_BASE_URL=https://api.mekari.com ``` -------------------------------- ### GET Contact List Source: https://docs.qontak.com/docs/omnichannel-hub/c0706c0323965-contact-list Retrieves a list of all contact lists associated with your account. This endpoint allows you to view existing lists, their contact counts, and creation details. ```APIDOC ## GET /api/open/v1/contacts/contact_lists ### Description Retrieves a list of all contact lists. This endpoint is useful for viewing existing contact lists, their associated metadata, and statistics. ### Method GET ### Endpoint https://service-chat.qontak.com/api/open/v1/contacts/contact_lists ### Parameters #### Query Parameters - **limit** (integer) - Optional - The number of results to return per page. - **offset** (integer) - Optional - The number of results to skip before starting to collect the result set. #### Request Body This endpoint does not require a request body. ### Request Example ```bash curl --request GET \ --url 'https://service-chat.qontak.com/api/open/v1/contacts/contact_lists?limit=10&offset=0' \ --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ --header 'Content-Type: application/json' ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the request, e.g., "success". - **data** (array) - An array of contact list objects. - **id** (string) - The unique identifier for the contact list. - **organization_id** (string) - The identifier of the organization this list belongs to. - **source_type** (string) - The type of source from which the contacts were imported (e.g., "spreadsheet"). - **source_id** (string) - The identifier of the source. - **name** (string) - The name of the contact list. - **contacts_count** (integer) - The total number of contacts in the list. - **contacts_count_success** (integer) - The number of contacts successfully processed. - **contacts_count_failed** (integer) - The number of contacts that failed processing. - **created_at** (string) - The timestamp when the contact list was created. - **updated_at** (string) - The timestamp when the contact list was last updated. - **contact_variables** (array of strings) - A list of variable names associated with contacts in this list. - **finished_at** (string) - The timestamp when the contact list processing was finished. - **error_messages** (object) - An object containing any error messages related to the list processing. - **progress** (string) - The current progress status of the list processing (e.g., "success"). - **meta** (object) - Metadata about the response, including pagination details. - **pagination** (object) - **cursor** (object) - **next** (string) - Cursor for the next page of results. - **prev** (string) - Cursor for the previous page of results. - **offset** (integer) - The current offset. - **limit** (integer) - The limit applied to the results per page. - **total** (integer) - The total number of contact lists available. #### Response Example (200) ```json { "status": "success", "data": [ { "id": "82345b7d-f6fe-4905-9a4a-67eb1cd00998", "organization_id": "7e6e0187-6707-464f-8b99-59b094caae0b", "source_type": "spreadsheet", "source_id": "", "name": "Testing List", "contacts_count": 1, "contacts_count_success": 1, "contacts_count_failed": 0, "created_at": "2021-07-08T07:02:13.169Z", "updated_at": "2021-07-08T07:02:13.876Z", "contact_variables": [ "customer_name", "company", "no_receipt" ], "finished_at": "2021-07-08T07:02:13.477Z", "error_messages": {}, "progress": "success" } ], "meta": { "pagination": { "cursor": { "next": "MTYyNDM1MzExMi42OTg=", "prev": "MTYyNTcyNzczMy4xNjk=" }, "offset": 0, "limit": 10, "total": 58 } } } ``` #### Error Response (401) - **status** (string) - Indicates the status of the request, e.g., "error". - **error** (object) - **code** (integer) - The HTTP status code, e.g., 401. - **messages** (array of strings) - A list of error messages. #### Response Example (401) ```json { "status": "error", "error": { "code": 401, "messages": [ "Invalid token" ] } } ``` #### Error Response (422) - **status** (string) - Indicates the status of the request, e.g., "error". - **error** (object) - **code** (integer) - The HTTP status code, e.g., 422. - **messages** (array of objects) - A list of detailed error messages. - **active_model_errors** (object) - Contains validation errors for specific fields. - **type** (string) - The type of error. #### Response Example (422) ```json { "status": "error", "error": { "code": 422, "messages": [ { "active_model_errors": { "offset": [ "must be an integer" ] }, "type": "expectation_failed" } ] } } ``` ``` -------------------------------- ### Broadcast Log Status Event Source: https://docs.qontak.com/docs/omnichannel-hub/1d2a6557d37a8-message-interaction-webhooks Provides the example response structure for the `broadcast_log_status` event, detailing the status and details of broadcast messages. ```APIDOC ## Broadcast Log Status Event ### Description This section details the example response payload for the `broadcast_log_status` event. This event provides comprehensive information about the status and delivery details of broadcast messages sent through the Qontak platform. ### Response Example for `broadcast_log_status` Event ```json { "id": "string", "organization_id": "string", "messages_broadcast_id": "string", "messages_broadcast_template_id": "string", "contact_phone_number": "string", "contact_full_name": "string", "status": "string", "whatsapp_message_id": "string", "whatsapp_error_message": "string", "messages_response": { "read": { "statuses": [ { "id": "string", "recipient_id": "string", "status": "string", "timestamp": "integer" } ], "webhook": "string" }, "contacts": [ { "input": "string", "wa_id": "string" } ], "messages": [ { "id": "string", "message_status": "string" } ], "delivered": { "webhook": "string", "statuses": [ { "id": "string", "status": "string", "pricing": { "billable": "boolean", "category": "string", "pricing_model": "string" }, "timestamp": "integer", "conversation": { "id": "string", "origin": { "type": "string" } }, "recipient_id": "string" } ] }, "messaging_product": "string" }, "messages": { "body": { "type": "string", "template": "string", "parameters": "array" }, "header": { "type": "string", "template": "object", "parameters": "array" }, "buttons": { "type": "string", "template": "null", "parameters": "array" } }, "created_at": "datetime", "is_pacing": "boolean", "data_event": "string", "webhook_event": "string" } ``` ``` -------------------------------- ### Example Webhook Response Structure Source: https://docs.qontak.com/docs/omnichannel-hub/1d2a6557d37a8-message-interaction-webhooks This JSON object represents a successful response after configuring message interaction webhooks. It outlines the various settings and webhook configurations available, including enabled states and associated webhook URLs for different event types. ```json { "status": "string", "data": { "auto_assign_agent": "boolean", "auto_responder_in_office_hours": { "enabled": "boolean", "message": "string" }, "auto_responder_out_office_hours": { "enabled": "boolean", "message": "string" }, "agent_can_takeover": "boolean", "custom_agent_allocation": { "enabled": "boolean", "webhooks": [ { "id": "string", "event": "string", "url": "string" } ] }, "agent_assigned_to_room": { "enabled": "boolean", "webhooks": [] }, "agent_unassigned_from_room": { "enabled": "boolean", "webhooks": [] }, "room_resolved": { "enabled": "boolean", "webhooks": [] }, "receive_message_from_agent": { "enabled": "boolean", "webhooks": [ { "id": "string", "event": "string", "url": "string" } ] }, "receive_message_from_customer": { "enabled": "boolean", "webhooks": [ { "id": "string", "event": "string", "url": "string" } ] }, "broadcast_log_status": { "enabled": "boolean", "webhooks": [ { "id": "string", "event": "string", "url": "string" } ] }, "status_message": { "enabled": "boolean", "webhooks": [ { "id": "string", "event": "string", "url": "string" } ] } } } ``` -------------------------------- ### Get Available WhatsApp Message Templates Source: https://docs.qontak.com/docs/omnichannel-hub/08dd8ed375f87-whats-app-outbound-message-direct-api Retrieves a list of approved WhatsApp message templates available in your account. This is necessary to use predefined message formats for sending notifications. ```APIDOC ## GET /api/open/v1/templates/whatsapp ### Description Retrieves a list of approved WhatsApp message templates available in your account. ### Method GET ### Endpoint `{{BaseUrl}}/api/open/v1/templates/whatsapp` ### Parameters #### Query Parameters None #### Path Parameters None #### Request Body None ### Request Example ```bash curl -X GET \ 'https://service-chat.qontak.com/api/open/v1/templates/whatsapp' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the response ('success' or 'error'). - **data** (array) - An array of message template objects. - **id** (string) - The unique identifier for the message template. - **name** (string) - The name of the message template. - **language** (string) - The language of the template (e.g., 'id'). - **body** (string) - The content of the message template, with placeholders like `{{1}}`. - **status** (string) - The approval status of the template (e.g., 'APPROVED'). - **category** (string) - The category of the template (e.g., 'PAYMENT_UPDATE'). - **meta** (object) - Metadata about the response, including pagination. #### Response Example ```json { "status": "success", "data": [ { "id": "cf7a16bd-e84f-4f72-8cce-70934edfc585", "name": "message", "language": "id", "header": null, "body": "Hi {{1}}, Silakan periksa invoice di email anda.", "footer": null, "status": "APPROVED", "category": "PAYMENT_UPDATE" } ], "meta": { "pagination": { "cursor": { "next": "MTU5MTI1OTg5OC45NzQwMDAy", "prev": "MTU5NTkwODgwNy4yNjQ5OTk5" }, "offset": 1, "limit": 48, "total": 48 } } } ``` ### WhatsApp Message Template ID Use the `id` field from the response (e.g., `cf7a16bd-e84f-4f72-8cce-70934edfc585`) as the `message_template_id` when sending messages. ``` -------------------------------- ### Get Available WhatsApp Message Templates Source: https://docs.qontak.com/docs/omnichannel-hub/e704aba31cb4b-whats-app-outbound-message-bulk This endpoint allows you to retrieve a list of your approved WhatsApp message templates. This is necessary before sending notification messages. The request requires an Authorization header. The response includes details of each template, such as its ID, name, language, body, status, and category. ```shell GET https://service-chat.qontak.com/api/open/v1/templates/whatsapp Authorization: ``` -------------------------------- ### Get Available WhatsApp Channels Source: https://docs.qontak.com/docs/omnichannel-hub/e704aba31cb4b-whats-app-outbound-message-bulk This API retrieves a list of available WhatsApp channels integrated with your Qontak account. It requires the 'target_channel' parameter set to 'wa' and an Authorization header. The response details each channel's ID, target channel type, webhook information, settings, and creation timestamp. ```shell GET https://service-chat.qontak.com/api/open/v1/integrations?target_channel=wa Authorization: ``` -------------------------------- ### Successful Token Refresh Response Source: https://docs.qontak.com/docs/omnichannel-hub/50e85232fb795-authentication This is an example of a successful response after requesting a token refresh. It contains the new `access_token`, `token_type`, `expires_in` duration, a new `refresh_token`, and the timestamp of creation. ```json { "access_token": "WPuW1u-v21SkfqfC7NNBD9NvNg3ojy8ftuUpVy3ArbU", "token_type": "Bearer", "expires_in": 29823918, "refresh_token": "UU_3xp5jRN0fsNKDrVAEh4QqdRody3Wc37VQHFZ37C4", "created_at": 1594354514 } ``` -------------------------------- ### WhatsApp Message Template Creation Guidelines Source: https://docs.qontak.com/docs/omnichannel-hub/808962a59619e-whats-app-message-template Guidelines for creating a WhatsApp Message Template, including naming conventions, component requirements, formatting, language, and category. ```APIDOC ## WhatsApp Message Template Creation ### Description This endpoint allows for the creation of WhatsApp Message Templates. Adherence to specific guidelines is mandatory for successful template submission and approval. ### Method POST ### Endpoint `/whatsapp/templates` (Assumed endpoint based on context) ### Parameters #### Request Body - **name** (string) - Required - Message template name. Must contain only lowercase alphanumeric characters and underscores (_). No other characters or whitespace are allowed. - **components** (object) - Required - Components of the message template, including text and/or media components with parameter placeholders. - **BODY** (object) - Required - The body of the message template. - **type** (string) - Must be "BODY". - **text** (string) - Required - The text content of the body. Must contain no newlines, tabs, or more than 4 consecutive spaces. Character limit is 1024. - **example** (string) - Optional - An example of the text content for the body, used for preview. - **language** (string) - Required - The language code for the template. Refer to the 'List Language' API for available codes (e.g., 'en', 'en_US', 'fil', 'id', 'ms', 'th', 'pt_BR'). - **category** (string) - Required - The category of the template. Refer to the 'List Category' API for available values (e.g., 'ACCOUNT_UPDATE', 'PAYMENT_UPDATE', 'SHIPPING_UPDATE'). ### Request Example ```json { "name": "order_confirmation", "language": "en", "category": "SHIPPING_UPDATE", "components": [ { "type": "BODY", "text": "Your order {{1}} for a total of {{2}} is confirmed. The expected delivery is {{3}}.", "example": "Your order 12345 for a total of $50.00 is confirmed. The expected delivery is tomorrow." } ] } ``` ### Response #### Success Response (200) - **id** (string) - The ID of the created message template. - **status** (string) - The status of the template (e.g., 'PENDING', 'APPROVED'). #### Response Example ```json { "id": "tmpl_abc123", "status": "PENDING" } ``` ### Notes - Once submitted for approval, a message template cannot be edited. - Refer to Facebook's official documentation for detailed guidelines on message templates: https://developers.facebook.com/docs/whatsapp/message-templates/guidelines. - Use the `List Language` and `List Category` APIs to retrieve available options for the `language` and `category` fields, respectively. ``` -------------------------------- ### POST Contact List using cURL Source: https://docs.qontak.com/docs/omnichannel-hub/c0706c0323965-contact-list This snippet demonstrates how to send a POST request to create a contact list asynchronously. It requires an Authorization header and specifies the content type as multipart/form-data. The request includes parameters for name, source_type, source_id, and file. ```shell curl --request POST \ --url https://service-chat.qontak.com/api/open/v1/contacts/contact_lists/async \ --header 'Authorization: Bearer undefined' \ --header 'Content-Type: multipart/form-data' \ --header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \ --form name= \ --form source_type=crm_dynamic \ --form source_id= \ --form file= ``` -------------------------------- ### Room Interaction Webhook Source: https://docs.qontak.com/docs/omnichannel-hub/05ac436aa2455-webhook Get notified about events related to chat rooms, such as when a room is resolved. ```APIDOC ## Room Interaction Webhook ### Description Enables receiving webhook notifications when a chat room interaction occurs, specifically when a room is resolved. ### Method POST (for registration), Webhook POST (for receiving notifications) ### Endpoint /webhook (for registration), [Registered URL] (for receiving notifications) ### Parameters #### Request Body (for receiving notifications) - **event_type** (string) - The type of room event (e.g., 'room_resolved'). - **data** (object) - Contains details about the room interaction. - **room_id** (string) - Unique identifier for the room. - **resolved_at** (string) - Timestamp when the room was resolved. - **resolved_by** (string) - Identifier of the user who resolved the room. ### Response Example (Receiving Notification) ```json { "event_type": "room_resolved", "data": { "room_id": "room_abcde123", "resolved_at": "2023-10-27T10:15:00Z", "resolved_by": "agent_id_xyz" } } ``` ``` -------------------------------- ### Get Log Broadcast Message Source: https://docs.qontak.com/docs/omnichannel-hub/e704aba31cb4b-whats-app-outbound-message-bulk Retrieves a list of WhatsApp broadcast logs. This endpoint is available for admin and supervisor roles. ```APIDOC ## GET /api/open/v1/broadcasts/{id/whatsapp/log ### Description Retrieves a list of Whatsapp broadcast log. User scope for this template are admin and supervisor. For authentication, you must include the access token in the HTTP Header. ### Method GET ### Endpoint https://service-chat.qontak.com/api/open/v1/broadcasts/{id/whatsapp/log ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the broadcast to get logs for. #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **status** (string) - The status of the request. - **data** (array) - An array of broadcast log entries. - **id** (string) - The log entry ID. - **organization_id** (string) - The organization ID. - **messages_broadcast_id** (string) - The broadcast message ID. - **contact_phone_number** (string) - The contact's phone number. - **contact_full_name** (string) - The contact's full name. - **status** (string) - The status of the message (e.g., 'delivered'). - **whatsapp_message_id** (string) - The WhatsApp message ID. - **whatsapp_error_message** (string) - Any error message from WhatsApp. - **messages_response** (object) - The response from the WhatsApp API. - **messages** (object) - Details about the message content. - **created_at** (string) - The timestamp when the log was created. - **meta** (object) - Metadata for pagination. #### Response Example ```json { "status": "success", "data": [ { "id": "e321646f-595d-4a13-bfe0-491e8bd4a49e", "organization_id": "7e6e0187-6707-464f-8b99-59b094caae0b", "messages_broadcast_id": "916dcc2a-d49e-491a-baee-c1786c64ea96", "contact_phone_number": "6282113410474", "contact_full_name": "Burhanudin Hakim", "status": "delivered", "whatsapp_message_id": "gBGHYoIRNBBHTwIJw0J-68xQihiX", "whatsapp_error_message": "n/a", "messages_response": { "messages": [ { "id": "gBGHYoIRNBBHTwIJw0J-68xQihiX" } ], "meta": { "api_status": "stable", "version": "2.33.4" }, "sent": { "statuses": [ { "id": "gBGHYoIRNBBHTwIJw0J-68xQihiX", "status": "sent", "timestamp": "1625210182", "recipient_id": "6282113410474" } ] }, "delivered": { "statuses": [ { "id": "gBGHYoIRNBBHTwIJw0J-68xQihiX", "recipient_id": "6282113410474", "status": "delivered", "timestamp": "1625210184" } ] } }, "messages": { "header": { "type": "header", "parameters": [], "template": {} }, "body": { "type": "body", "parameters": { "1": "audrey", "2": "audreydatau@gmail.com", "3": "2700" }, "template": "Helo {{1}}, penggunaan paket data untuk akun {{2}} hari ini sejumlah {{3}} Mb" } }, "created_at": "2021-07-02T07:16:22.549Z" } ], "meta": { "pagination": { "cursor": { "next": "MTYyNTIxMDE4Mi41NDk=", "prev": "MTYyNTIxMDE4Mi41NDk=" }, "offset": 1, "limit": 100, "total": 1 } } } ``` ``` -------------------------------- ### API Reference: service-chat.qontak.com v1.0.3 Source: https://docs.qontak.com/docs/omnichannel-hub/183d86fcd6f8e-introduction Reference for the service-chat.qontak.com v1.0.3 API, utilizing OAuth2 authentication for managing messages, rooms, contacts, and more. ```APIDOC ## API Reference: `service-chat.qontak.com` v1.0.3 ### Description This section details the `service-chat.qontak.com` version 1.0.3 API, which uses OAuth2 authentication. It covers functionalities for managing messages, chat rooms, contacts, and other related features. ### Available Resources * **Auth:** Authentication related endpoints. * **Integrations:** Manage integrations. * **Broadcasts:** Manage broadcast messages. * **File Uploader:** Upload files. * **Templates:** Manage message templates. * **Rooms:** Manage chat rooms. * **Messages:** Send and manage messages. * **Message Interactions:** Handle message interactions. * **Room Interactions:** Manage room interactions. * **Waba Interactions:** Manage WABA (WhatsApp Business API) interactions. * **Contacts:** Manage contact information. * **Contact Objects:** Manage contact objects. * **Reports:** Access reports. * **Custom Fields:** Manage custom fields. * **Divisions:** Manage company divisions. * **Contact Block:** Manage contact blocking. ### Schemas * Documentation for data schemas used by the API. ```