Edit a Message Channel
Edit a message channel.
Note: This API endpoint can be used to edit an SMS channel, WhatsApp channel, or Facebook channel. To edit a Live Chat channel, see Edit a Live Chat Channel.
Request URL
POST {base_url}/{api_path}/message_channel/update?access_token={access_token}
Request parameters
Send different request parameters according to different types of message channel.
- Edit an SMS channel
- Edit a WhatsApp channel
- Edit a Facebook channel
Edit an SMS channel
| Parameter | Required | Type | Description |
|---|---|---|---|
| id | Yes | Integer | The unique ID of the message channel.Note:You can query the message channel ID using Search Specific Message Channels. |
| name | No | String | Message channel name.Note:The length must not exceed 127 characters. |
| webhook_url_type | No | String | The type of domain used in the Webhook URL.Valid value:
|
| account_data | No | Array<Auth_Info> | The data required by the service provider for message channel connection. |
| send_rate | No | Integer | Specify the number of messages that PBX can send per second via the message channel. |
| auto_close_session | No | Integer | Whether to automatically close a message session after it has been inactive for a specified period of time. |
| session_expired_time | No | Integer | The duration of inactivity (in days) after which a session is automatically closed. |
| enb_duplicate_active_session | No | Integer | Whether to allow creating a new session when an active session with the same sender and receiver already exists. Valid value:
|
| accompanying_msg | No | String | The accompanying text content for chat file.Note:This parameter is REQUIRED when creating an Apidaze SMS channel. |
| dids | No | Array<Msg_Routing> | Define the message routing rule by adding the DID number(s), setting message destination, and specifying members that are allowed to initiate message sessions via specified DID number. |
Auth_InfoNote:Provide the required parameter values according to the requirements of different SMS service providers.
| Parameter | Required | Type | Description |
|---|---|---|---|
| k | Yes | String | The name of the key field required by the service provider.Valid value:
|
| v | Yes | String | The value associated with the key field k. Valid value:
|
Msg_RoutingImportant:Always submit all fields you wish to retain, as partial updates are not supported. Fields omitted from the request body will be cleared or reset to default values.
| Parameter | Required | Type | Description |
|---|---|---|---|
| id | No | Integer | The unique ID of an existing DID number.Note:
|
| did_number | Yes | String | The DID number associated with the message channel. |
| destination_type | Yes | String | The type of the destination. Valid value:
|
| destination_id | No | String | The unique ID of destination to which inbound messages are sent.Note:
|
| members | No | Array<Members> | The members that are allowed to initiate message sessions using the DID number. |
Members
| Parameter | Required | Type | Description |
|---|---|---|---|
| type | Yes | String | Member type. Valid value:
|
| value | Yes | String | The unique ID of the member. Note:You can query the member ID using Get Menu Options (menu=extension/ext_group/org_list). |
Edit a WhatsApp channel
| Parameter | Required | Type | Description |
|---|---|---|---|
| id | Yes | Integer | The unique ID of the message channel.Note:You can query the message channel ID using Search Specific Message Channels. |
| name | No | String | Message channel name.Note:The length must not exceed 127 characters. |
| webhook_url_type | No | String | The type of domain used in the Webhook URL. Valid value:
|
| account_data | No | Array<Auth_Info> | The data required by the service provider for message channel connection. |
| phone_number_id | No | String | The ID of the WhatsApp phone number. Note: The length must not exceed 31 characters. |
| business_account_id | No | String | The ID of the WhatsApp business account. Note:
|
| dids | No | Array<Msg_Routing> | Define the message routing rule by adding the WhatsApp phone number, setting message destination, and specifying members that are allowed to initiate message sessions via the phone number. |
| auto_close_session | No | Integer | Whether to automatically close a message session after it has been inactive for a specified period of time. |
| session_expired_time | No | Integer | The duration of inactivity (in days) after which a session is automatically closed. |
| enb_duplicate_active_session | No | Integer | Whether to allow creating a new session when an active session with the same sender and receiver already exists. Valid value:
|
Auth_Info
| Parameter | Required | Type | Description |
|---|---|---|---|
| k | Yes | String | The name of the key field required by the service provider. Valid value:
|
| v | Yes | String | The value associated with the key field k. Note:The value should be passed in Base64-encoded format. |
Msg_Routing
| Parameter | Required | Type | Description |
|---|---|---|---|
| did_number | Yes | String | The WhatsApp phone number in E.164 format. |
| destination_type | Yes | String | The type of the destination. Valid value:
|
| destination_id | No | String | The unique ID of destination to which inbound messages are sent. Note:
|
| members | No | Array<Members> | The members that are allowed to initiate message sessions via the WhatsApp phone number. |
Members
| Parameter | Required | Type | Description |
|---|---|---|---|
| type | Yes | String | Member type. Valid value:
|
| value | Yes | String | The unique ID of the member. Note:You can query the member ID using Get Menu Options (menu=extension/ext_group/org_list). |
Edit a Facebook channel
| Parameter | Required | Type | Description |
|---|---|---|---|
| id | Yes | Integer | The unique ID of the message channel. Note:You can query the message channel ID using Search Specific Message Channels. |
| name | No | String | Message channel name. Note:The length must not exceed 127 characters. |
| webhook_url_type | No | String | The type of domain used in the Webhook URL. Valid value:
|
| account_data | No | Array<Auth_Info> | The data required by the service provider for message channel connection. |
| dids | No | Array<Msg_Routing> | Define the message routing rule by adding the Facebook page ID and setting message destination. |
| auto_close_session | No | Integer | Whether to automatically close a message session after it has been inactive for a specified period of time. |
| session_expired_time | No | Integer | The duration of inactivity (in days) after which a session is automatically closed. |
Auth_Info
| Parameter | Required | Type | Description |
|---|---|---|---|
| k | Yes | String | The name of the key field required by the service provider. Valid value:
|
| v | Yes | String | The value associated with the key field k. Note: For access_token and app_secret fields, enter the value in Base64-encoded format. |
Msg_Routing
| Parameter | Required | Type | Description |
|---|---|---|---|
| did_number | Yes | String | Facebook page ID. |
| destination_type | Yes | String | The type of the destination. Valid value:
|
| destination_id | No | String | The unique ID of destination to which inbound messages are sent. Note:
|
Response parameters
| Parameter | Type | Description |
|---|---|---|
| errcode | Integer | Returned error code.
|
| errmsg | String | Returned message.
|
Examples
Request example
Change the destination of a DID number (ID: 5) in an SMS channel (ID: 267).
POST /openapi/v1.0/message_channel/update?access_token=ybE6c2R2617EOQnaLAWaoiUEbC1NvTug HTTP/1.1
Host: 192.168.5.150:8088
Content-Type: application/json
{
"id":267,
"dids":[
{
"id":5,
"did_number":"+12125551234",
"destination_type":"api", //Change destination to Third-party message analytics platform (transmitted via API).
"members":
[
{
"type":"organization",
"value":"3"
},
{
"type":"extension",
"value":"137"
}
]
},
// All entries must be included in the update request; otherwise, missing entries will be cleared.
{
"id":3,
"did_number":"+442079460857",
"destination_type":"extension",
"destination_id":"137",
"members":[
{
"type":"extension",
"value":"137"
}
]
}
]
}Response example
HTTP/1.1 200 OK
{
"errcode": 0,
"errmsg": "SUCCESS"
}