Get Live Chat Embed Code

Get the code snippet of a Live Chat channel, which can be embedded into the desired website to enable live chat functionality.

Request URL

GET {base_url}/{api_path}/message_channel/embedcode?access_token={access_token}

Request parameters

Parameter Required Type Description
id Yes Integer The unique ID of the Live Chat channel.
Note: You can query the channel ID using Search Specific Message Channels.
email No String The email address to which the embed code will be sent.

The system will send an email containing the embed code as well as installation instructions to the specified email address.

Response parameters

Parameter Type Description
errcode Integer Returned error code.
  • 0: Succeed.
  • Non-zero value: Failed.
Note: You can check the error code and error message in Error Code and Error Message.
errmsg String Returned message.
  • SUCCESS: Succeed.
  • FAILURE: Failed.
website_domain String The domain name of the website where the Live Chat channel will be embedded.
embed_code String The embed code of the Live Chat channel.

Examples

Request example

GET /openapi/v1.0/message_channel/embedcode?access_token=kq3ftCp8VfTjrk1gqW5NW0sijhWE4yiL&id=6&email=demo@yeastar.com HTTP/1.1

Host: yeastardocs.example.yeastarcloud.com

Response example

HTTP/1.1 200 OK
{
    "errcode": 0,
    "errmsg": "SUCCESS",
    "website_domain": "www.yeastar.com",
    "embed_code": "<script src=\"https://docs.example.yeastar.com/live_chat.v1.0.0.js?channelNumber=LC00000\"></script>"
}