首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将LiveChat仪表板与集成用于代理切换?

如何将LiveChat仪表板与集成用于代理切换?
EN

Stack Overflow用户
提问于 2021-09-02 06:00:13
回答 1查看 222关注 0票数 0

当用户在google聊天机器人上询问或选择“代理”/“与代理聊天”选项时,它应该将聊天转移到LiveChat(https://www.livechat.com/)仪表板上,以便由代理接管聊天机器人。

EN

回答 1

Stack Overflow用户

发布于 2022-01-14 11:36:36

要从没有安装LiveChat聊天窗口的页面将数据传递到LiveChat,可以使用LiveChat API中的以下方法:https://developers.livechat.com/docs/messaging/agent-chat-api#create-customer创建客户

然后,以该客户的身份开始聊天:

https://developers.livechat.com/docs/messaging/customer-chat-api#start-chat

一旦聊天启动-您可以使用以下方法提交事件:https://developers.livechat.com/docs/messaging/customer-chat-api#send-event

关于上述所有需要提供授权的内容,请参见下面的https://developers.livechat.com/docs/authorization/authorizing-api-calls

为了获得授权,您需要在LiveChat Developer控制台中的一个帐户:https://developers.livechat.com/console/

在控制台中,您还可以找到与LiveChat开发人员社区的联系(不和谐和电子邮件)。

编辑:下面是更多的手放在上面的样子:

  1. 我们需要做的第一件事是获得身份验证--在本例中,我们想作为客户进行身份验证,有几种方法可以作为客户进行身份验证--下面是关于所有方法的说明:https://developers.livechat.com/docs/authorization/authorizing-api-calls#case-new-customer

我将使用代理令牌授予方法,并通过发送以下curl获得客户访问令牌:

代码语言:javascript
复制
curl --location --request POST 'https://accounts.livechat.com/customer/token' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer dal:xxxFpzmIHk5c86Zwn3uf2YunhGk' \
--data-raw '{
"grant_type": "agent_token",
"client_id": "3xxx45a50544060cedc26c90644f7677",
"response_type": "token",
"redirect_uri": "https://my.livechatinc.com"
}
'

以下是收到的答复:

代码语言:javascript
复制
{
    "access_token": "dal:xxx-zH-fTOKYJsUolAKzow",
    "client_id": "xxx145a50544060cedc26c90644f7677",
    "entity_id": "xxx1d260-e284-44c0-53d2-3e958f74488a",
    "expires_in": 28800,
    "token_type": "Bearer"
}
  1. 一旦获得了客户访问令牌,我们将寻找发送“开始聊天”的方法

此请求需要一个名为"organization_id“的参数--这是所有LiveChat Inc. .产品中您帐户的唯一标识符,因此我们只需要获得一次,您可以通过发送以下curl来获得它:

代码语言:javascript
复制
curl --location --request GET 'https://api.livechatinc.com/v3.4/configuration/action/get_organization_id?license_id=1234567'

上面所需的许可证ID可以在您的LiveChat跟踪代码中找到:https://my.livechatinc.com/settings/code

发送请求将在响应中为您提供"organization_id“:

代码语言:javascript
复制
{
    "organization_id": "xxx29b0e-012c-4384-9f72-614324ec0xxx"
}

既然我们有了一切-我们就可以开始聊天了:

代码语言:javascript
复制
curl --location --request POST 'https://api.livechatinc.com/v3.4/customer/action/start_chat?organization_id=xxx29b0e-012c-4384-9f72-614324ec0741' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer dal:xxx-zH-fTOKYJsUolAKzow' \
--data-raw '{}'

反应是这样的:

代码语言:javascript
复制
{
    "chat_id": "R5MUSNS1I5",
    "thread_id": "R5MUSNS1J5"
}

来自上述响应的chat_id属性对于发送事件和在访问者将来想再次聊天时恢复聊天非常有用。

  1. 为了发送消息,我们将使用"send_event“方法,如下所示:
代码语言:javascript
复制
curl --location --request POST 'https://api.livechatinc.com/v3.4/customer/action/send_event?organization_id=xxx29b0e-012c-4384-9f72-614324ec0741' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer dal:xxx-zH-fTOKYJsUolAKzow' \
--data-raw '{
    "chat_id": "R5MUSNS1I5",
    "event": {
      "type": "message",
      "text": "hello world",
      "recipients": "all"
    }
  }'

结果是:来袭聊天

我希望这能帮上忙!

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69024877

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档