Conversation Account¶
Account¶
{
"id": "<string>",
"customer_id": "<string>",
"type": "<string>",
"name": "<string>",
"detail": "<string>",
"provider_data": {},
"message_flow_id": "<string>",
"tm_create": "<string>",
"tm_update": "<string>",
"tm_delete": "<string>"
}
id(UUID): The conversation account’s unique identifier. Returned when creating viaPOST /conversation_accountsor listing viaGET /conversation_accounts.customer_id(UUID): The customer who owns this conversation account. Obtained from theidfield ofGET /customers.type(enum string): The messaging platform type. See Type.name(string): A human-readable name for this conversation account.detail(string): Additional description or notes about this account.provider_data(object): Provider-specific configuration set at creation time. Omitted if not set. For WhatsApp accounts, containsphone_number_idandapp_secret. See WhatsApp Account Fields. For KakaoTalk accounts it is write-only and is never returned. See KakaoTalk Account Fields.message_flow_id(UUID): The flow to execute when a message is received on this account. Obtained from theidfield ofGET /flows. Set to00000000-0000-0000-0000-000000000000if no flow is assigned.tm_create(string, ISO 8601): Timestamp when this account was created.tm_update(string, ISO 8601): Timestamp of the last update to this account.tm_delete(string, ISO 8601): Timestamp when this account was deleted. Set to9999-01-01 00:00:00.000000if not deleted.
Type¶
All possible values for the type field:
Type |
Description |
|---|---|
line |
LINE messaging platform account |
sms |
SMS messaging account |
WhatsApp Business account (Meta Cloud API) |
|
kakaotalk |
KakaoTalk counseling talk channel |
secret, token and provider_data mean different things for each type:
Type |
|
|
|
|---|---|---|---|
line |
Channel secret. |
Channel access token. |
Not used. |
sms |
Not used. |
Not used. |
Not used. |
Webhook verify token. |
Meta system user access token. |
|
|
kakaotalk |
Secret path segment of the webhook URL. |
API key of the counseling talk provider. |
|
WhatsApp Account Fields¶
When creating a whatsapp account, the following fields are required in addition to name, detail, and message_flow_id.
token(string, write-only): The Meta system user access token. Used as the Bearer token when calling the Meta Cloud API to send outbound messages. Never returned in API responses.secret(string, write-only): The webhook verify token. Echoed back verbatim during the Meta hub challenge (GETrequest from Meta to your webhook URL). Never returned in API responses.provider_data(object): WhatsApp-specific configuration. Returned inGETresponses. Contains the following keys:phone_number_id(string): The Meta phone number ID associated with your WhatsApp Business phone number. Found in Meta Business Manager under WhatsApp → Phone numbers.app_secret(string): The Meta app secret. Used to validate theX-Hub-Signature-256header on inbound webhook requests.
Note
token and secret are write-only. They are accepted on POST /conversation_accounts and PUT /conversation_accounts/{id} but are never included in GET responses or webhook payloads. provider_data is readable and returned in GET responses.
WhatsApp Webhook URL¶
When configuring the webhook in Meta Business Manager, use the following URL pattern:
https://hook.voipbin.net/v1.0/conversation/accounts/{account_id}
Replace {account_id} with the id returned when the account is created.
Meta sends two types of requests to this URL:
Hub challenge (
GET): Sent by Meta to verify your endpoint. VoIPBin responds automatically using thesecret(verify token) you configured.Inbound messages (
POST): WhatsApp messages forwarded by Meta. VoIPBin validates theX-Hub-Signature-256header usingapp_secretfromprovider_data.
Inbound message identifiers
dialog_id: Set to the sender’s WhatsApp ID (wa_id), which is their E.164 phone number without the leading+(e.g.,15551234567).transaction_id: Set to the WhatsApp message ID (wamid), a unique identifier assigned by Meta to each message.
Outbound messages
VoIPBin sends outbound text messages via the Meta Cloud API using the phone_number_id from provider_data and the token you configured. The wamid returned by Meta is stored as the conversation message’s transaction_id.
KakaoTalk Account Fields¶
A kakaotalk account connects one KakaoTalk counseling talk channel. When creating it, the following fields are required in addition to name, detail, and message_flow_id.
token(string, write-only): The API key of the counseling talk provider. It is used to send outbound messages. The provider only accepts calls from IP addresses registered for the key, so register the IP address of the platform at the provider. Never returned in API responses.secret(string, write-only): The secret path segment of the webhook URL. 16 to 128 characters ofA-Z,a-z,0-9,_and-, with at least 8 distinct characters. Use a long random value. Never returned in API responses.provider_data(object, write-only): Containssender_key(string, 1 to 64 characters), the sender profile key of the KakaoTalk channel. It is compared with the key in every inbound webhook. Never returned in API responses, and aPUTreplaces the whole object.
A request with an invalid token, secret or sender_key is rejected with 400.
Note
The webhook URL contains secret and anyone who knows it can post messages to the account. Treat the URL as a credential. When you change secret, change the URL registered at the provider at the same time. Webhooks sent in between are rejected and the provider gives up after three retries.
KakaoTalk Webhook URL¶
Register the following URL at the counseling talk provider as the webhook URL of the channel:
https://hook.voipbin.net/v1.0/conversation/accounts/{account_id}/{secret}
Replace {account_id} with the id returned when the account is created and {secret} with the secret you configured. The provider appends /cstalk/message (and other event names) to the URL.
Only text messages are stored. Image and file messages and other events are acknowledged and ignored.
A webhook that fails authentication is answered with
401and nothing is stored. A webhook that could not be processed is answered with an error so that the provider retries it. A message that was already stored is stored once even if the provider sends it again.dialog_idis the user key assigned by the provider for this channel (1 to 64 characters, case sensitive), andtransaction_idis the message key of the provider.
Outbound messages
A text message of 1 to 1,000 characters can be sent in a conversation (POST /conversations/{id}/messages) while the counseling session is open: the user sent a message within the last 30 days. A message to a user without an open session is rejected with FailedPrecondition and nothing is sent, because KakaoTalk does not allow a business to start a counseling talk. The provider is the final judge of the session, so a message can also be rejected after the check, and then its status is failed. Sending to a counseling talk peer from a Case is not supported.
Examples¶
LINE account (no provider_data):
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"customer_id": "5e4a0680-804e-11ec-8477-2fea5968d85b",
"type": "line",
"name": "Customer Support LINE",
"detail": "LINE account for customer support inquiries",
"message_flow_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"tm_create": "2024-03-01T10:00:00.000000Z",
"tm_update": "2024-03-01T10:00:00.000000Z",
"tm_delete": "9999-01-01T00:00:00.000000Z"
}
KakaoTalk account (secret, token and provider_data are write-only and not returned):
{
"id": "d4e5f6a7-b8c9-0123-def0-234567890123",
"customer_id": "5e4a0680-804e-11ec-8477-2fea5968d85b",
"type": "kakaotalk",
"name": "KakaoTalk Counseling",
"detail": "KakaoTalk counseling talk channel for support",
"message_flow_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"tm_create": "2024-03-01T10:00:00.000000Z",
"tm_update": "2024-03-01T10:00:00.000000Z",
"tm_delete": "9999-01-01T00:00:00.000000Z"
}
WhatsApp account (with provider_data):
{
"id": "c3d4e5f6-a7b8-9012-cdef-123456789012",
"customer_id": "5e4a0680-804e-11ec-8477-2fea5968d85b",
"type": "whatsapp",
"name": "WhatsApp Customer Support",
"detail": "WhatsApp Business account via Meta Cloud API",
"provider_data": {
"phone_number_id": "123456789012345",
"app_secret": "abcdef1234567890abcdef1234567890"
},
"message_flow_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"tm_create": "2024-03-01T10:00:00.000000Z",
"tm_update": "2024-03-01T10:00:00.000000Z",
"tm_delete": "9999-01-01T00:00:00.000000Z"
}