添加在线咨询渠道

添加并配置在线咨询渠道。

请求 URL

POST {base_url}/{api_path}/message_channel/createlivechat?access_token={access_token}

请求参数

参数 是否必填 类型 说明
name String 消息渠道名称。
注: 长度不可超过 63 个字符。
website_domain String 要嵌入在线咨询渠道的网站的域名。
注: 长度不可超过 1023 个字符。
communication_method Integer 在线咨询渠道支持的咨询方式。
取值范围
  • 1:仅聊天。
  • 2:聊天和通话。
destination_type String 消息接收目的地的类型。
取值范围
  • extension:分机用户。
  • queue:消息队列。
  • api:第三方分析平台 (消息通过二次开发接口传递)
destination_id Integer 消息接收目的地的 ID。
注:
enable_webrtc_inbound_call Integer 是否启用 WebRTC 呼入功能,以允许访客通过在线咨询渠道发起通话。
取值范围
  • 0:禁用。
  • 1:启用。
webrtc_trunk_id Integer WebRTC 中继的唯一 ID。
注:
  • 此参数在 enable_webrtc_inbound_call 设为 1 时必填。
  • 可使用 搜索特定中继 接口查询 WebRTC 中继 ID (search_value=webtrunk)。
webrtc_inbound_route_id Integer WebRTC 中继呼入路由的唯一 ID。
注:
  • 此参数在 enable_webrtc_inbound_call 设为 1 时必填。
  • 可使用 搜索特定呼入路由 接口查询呼入路由 ID。
max_concurrent_call Integer 设置在线咨询渠道支持的最大通话并发数。

取值范围:1 - 10。

message_type Integer 访客可发送的消息类型。

取值范围

  • 1:文本和表情。
  • 2:文本、表情和图片。
auto_close_session Integer 是否自动关闭在指定时间内无任何互动的消息会话。
取值范围
  • 0:禁用。
  • 1:启用。
session_expired_time Integer 会话超时时间。消息会话在超过此指定时间未有任何互动后将自动关闭。
session_expired_unit String 会话超时时间的单位。
注: 此参数在 auto_close_session 设为 1 时必填。
取值范围
  • minite:分钟。
  • hour:小时。
  • day:天。
theme_mode String 在线咨询插件的主题模式。

取值范围::

  • light:浅色模式。
  • dark:深色模式。
theme_color String 在线咨询插件的主题颜色。

取值范围:6 位十六进制的 RGB 颜色值。例如:#00DDB3

minimize_style String 最小化窗口类型。

取值范围

  • round:气泡。
  • bar:条形。
chat_icon String 在线咨询插件的聊天图标。
取值范围
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
default_avatar String 客服头像的文件名 (ID)。
注: 如要使用自定义的客服头像,你需要先 上传头像文件,然后将上传 API 返回的 file 参数值填入此参数传送。
default_agent_name String 客服名称。
注: 长度不可超过 63 个字符。
show_agent_info Integer 是否展示客服信息。
取值范围
  • 0:不展示。
  • 1:展示客服名称。
  • 2:展示客服名称和头像。
hide_provider_info Integer 是否在插件中展示服务提供商信息 由星纵数字提供软件支持
取值范围
  • 0:展示。
  • 1:不展示。
language String 指定在线咨询插件的显示语言。
取值范围
  • BROWSER_LANGUAGE:跟随访客的浏览器语言。
  • en:English
  • zh-CN:简体中文 (Chinese Simplified)
  • zh-TW:繁體中文 (Chinese Traditional)
  • ar:العربية (Arabic)
  • pt_BR:Português Brasil (Portuguese Brazil)
  • cz:Čeština (Czech)
  • nl:Nederlands (Dutch)
  • fr:Française (French)
  • de:Deutsch (German)
  • he:עברית (Hebrew)
  • it:Italiano (Italian)
  • ja:日本語 (Japanese)
  • fa:فارسی (Persian)
  • pl:Polski (Polish)
  • pt:Português (Portuguese)
  • ru:Pусский (Russian)
  • sl:Slovenščina (Slovenian)
  • es:Español (Spanish)
  • th:ไทย (Thai)
  • tr:Türk (Turkish)
  • tk:Türkmenistan (Turkmen)
  • uk:Українська (Ukrainian)
  • vi:Tiếng Việt (Vietnamese)
enable_prechat_form Integer 是否启用预聊天表单。
取值范围
  • 0:禁用。
  • 1:启用。
prechat_form_title String 预聊天表单的标题。
注: 此参数在 enable_prechat_form 设为 1 时必填。
prechat_form_subtitle String 预聊天表单的子标题。
注: 此参数在 enable_prechat_form 设为 1 时必填。
show_name Integer 是否在预聊天表单中显示姓名字段。
注:enable_prechat_form 设为 1 时,show_nameshow_emailshow_phone 三个字段中至少有一个必须设为 1
取值范围
  • 0:不显示。
  • 1:显示。
show_email Integer 是否在预聊天表单中显示邮箱地址字段。
注:enable_prechat_form 设为 1 时,show_nameshow_emailshow_phone 三个字段中至少有一个必须设为 1
取值范围
  • 0:不显示。
  • 1:显示。
show_phone Integer 是否在预聊天表单中显示电话号码字段。
注:enable_prechat_form 设为 1 时,show_nameshow_emailshow_phone 三个字段中至少有一个必须设为 1
取值范围
  • 0:不显示。
  • 1:显示。
require_name Integer 预聊天表单中的姓名字段是否必填。
取值范围
  • 0:选填。
  • 1:必填。
require_email Integer 预聊天表单中的邮箱地址字段是否必填。
取值范围
  • 0:选填。
  • 1:必填。
require_phone Integer 预聊天表单中的电话号码字段是否必填。
取值范围
  • 0:选填。
  • 1:必填。
enable_data_privacy Integer 是否启用数据隐私与同意。
取值范围
  • 0:禁用。
  • 1:启用。
data_privacy_content String 数据隐私与同意的文本内容。
注:
  • 此参数在 enable_data_privacy 设为 1 时必填。
  • 长度不可超过 590 个字符。
online_welcome_message String 在系统处于工作时间且消息目的地可达时,访客进入聊天窗口后自动发送的欢迎消息。
注: 长度不可超过 255 个字符。
offline_welcome_message String 在系统处于非工作时间或消息目的地不可用时,访客进入聊天窗口后自动发送的欢迎消息。
注: 长度不可超过 255 个字符。
first_reply_message String 访客发送第一条消息后自动发送的回复消息。
注: 长度不可超过 255 个字符。
session_closed_message String 当消息会话结束时 (无论是由坐席或访客手动关闭会话,或因超时自动关闭会话) 自动发送的文本消息。
注: 长度不可超过 255 个字符。

响应参数

1.
参数 类型 说明
errcode Integer 返回错误码。
  • 0:请求成功。
  • 非零值:请求失败。
注: 更多错误码和错误信息说明,请参见 错误码 & 错误信息
errmsg String 返回信息。
  • SUCCESS:请求成功。
  • FAILURE:请求失败。
id Integer 消息渠道的唯一 ID。

示例

请求示例

POST /openapi/v1.0/message_channel/createlivechat?access_token=EX8zZM5hdq3krlPcNmBbDSqfKF1ovibL HTTP/1.1

Host: yeastardocs.example.yeastarcloud.com
Content-Type: application/json

{
    "name": "Docs-LiveChat Channel",
    "website_domain": "www.yeastar.com",
    "type": "livechat",
    "channel": "livechat",
    "communication_method": 2,
    "destination_type": "extension",    
    "destination_id": 137,
    "enable_webrtc_inbound_call": 1,  
    "webrtc_trunk_id": 3,
    "webrtc_inbound_route_id": 3,
    "max_concurrent_call": 5,
    "message_type": 2,    
    "auto_close_session": 1,
    "session_expired_unit": "day",
    "session_expired_time": 1,
    
    "theme_mode": "light",
    "theme_color": "#00DDB3",
    "minimize_style": "bar",
    "chat_icon": "6",  
    "default_avatar": "",  
    "default_agent_name": "Support",
    "show_agent_info": 0,  
    "hide_provider_info": 0, 

    "language": "BROWSER_LANGUAGE",
    "enable_prechat_form": 1,
    "prechat_form_title": "Hello 👋",
    "prechat_form_subtitle": "Please fill in the form below before starting the chat.",
    "show_email": 1,
    "show_name": 1,
    "show_phone": 1,
    "require_name": 1,
    "require_phone": 0,
    "require_email": 0,

    "enable_data_privacy": 1,
    "data_privacy_content": "<p>We need to store and process your personal data to provide you with the requested content. For detailed information about our privacy practices and our commitment to protecting your privacy, please check our Privacy Policy.</p>",
    "require_data_privacy_consent": 1,

    "online_welcome_message": "Hello! How can we help you?",
    "offline_welcome_message": "We are away, leave us a message!",
    "first_reply_message": "Hello, thank you for contacting us. We have received your message.",
    "session_closed_message": "This chat session has ended. Please feel free to contact us if you have any further questions."
}

响应示例

HTTP/1.1 200 OK
{
    "errcode": 0,
    "errmsg": "SUCCESS",
    "id": 219
}