Suite | Team, Growth, Professional, Enterprise, or Enterprise Plus |
在本文中,我们将带您了解在消息传送人工智能专员中添加和配置步骤所涉及的程序。
有关进行 API 调用步骤及其配置规则的概述,请参阅了解人工智能专员步骤类型:进行 API 调用。
本文章包括以下部分:
将“进行 API 调用”步骤添加到人工智能专员
将进行 API 调用步骤添加到人工智能专员涉及到各种任务。
添加“进行 API 调用”步骤
添加 API 详情
使用“API 详情”部分配置要进行的 HTTP 调用,包括 HTTP 请求方法、外部资源的位置,以及根据需要添加标头。以下步骤是上一部分程序的延续。
添加 API 详情
- 在配置面板中,单击 API 详情。
- 选择一个请求方法:
- GET 可从 API 服务检索外部资源。这是最常用的方法。
- POST 可发送数据以在外部系统中创建资源。如果资源已存在,则发送的数据将修改资源。
- PUT 可发送数据以更新资源。
- PATCH - 可发送数据以更新外部网站的资源,用于将部分修改应用于资源。
- DELETE - 可移除外部资源。
- 输入端点 URL。
该端点 URL 是要连接的外部资源的位置,端点 URL 支持
https://
协议。URL 的路径或查询字符串值中可以包含变量。有关更多信息,请参阅在 API 调用中传递变量。 - (可选)选择一个连接以对 API 调用进行身份验证。
注意:您必须先创建连接,才能在进行 API 调用步骤中使用。
- 如果需要,请输入可选标头的键值和值。重要提示:请勿使用标头进行身份验证,而应改用 API 连接。
包含身份验证相关标头(例如
authorization
或x-api-key
)的进行 API 调用步骤会自动失败。如果进行 API 调用步骤失败,对话将遵循该步骤的 API 调用失败分支。 - 单击进行 API 调用以测试 API 调用。
将变量添加到步骤的 URL 或标头可以在外部服务中包含可选的测试数据,以检查 API 调用是否如预期工作。请注意,这将向已配置的端点 URL 发出 HTTP 请求。
在 API 调用中传递变量
为 API 调用输入端点 URL,即可在 URL 的路径或查询字符串值中包含变量。这样可以将数据从对话传递到外部系统。
例如,消息传送人工智能专员可以使用询问详情步骤提示客户提供订单号。然后,人工智能专员可以使用进行 API 调用步骤从您的在线商店获取订单的送货状态。
端点 URL 的域名或子域名不能使用变量。下表列举了有效和无效端点 URL 值的示例。
有效端点 URL | 无效端点 URL |
---|---|
https://myshopify.com/admin/api/orders/order_number.json 指定 Shopify 的订单 ID 以检索订单。 ![]() |
变量不能添加到域名/子域名 |
从 Google 的场所 API 按关键字搜索检索位置。 |
变量不能添加到查询字符串键值 |
如果变量无效或为空,人工智能专员将在对话期间跳过该变量。
保存来自 API 响应的变量
配置详情并测试 API 调用后,可以将 API 调用的 JSON 响应的值保存为变量。在进行 API 调用步骤中,最多可以保存 12 个变量。只保存变量值的前 280 个字符。
根据响应数据创建变量
- 在配置面板中,单击进行 API 调用。
- 展开折叠面板,并确定要转为变量的外部系统数据。
提示:切换到响应正文标签可查看从外部系统返回的原始响应。
- 单击保存。
- 为新变量命名。
变量名称只能包含小写字母、数字和下划线。
在 API 调用中传递数组变量
{
"info": {
"count": 50,
"pages": 2,
"next": "https://mycompany.com/api/orders?page=2",
"prev": null
},
"results": [
{
"id": 1052,
"name": "Alexander Cummings",
“address”: “123 MyStreet”,
"Item": "belt",
"price": "15.00",
"image": "https://mycompany.com/api/orders/avatar/1.jpeg",
…
id
、name
、address
、item
、price
和 image
都会显示出来。此数据通常被传递到轮播,但轮播最多只能显示 10 个项目。
lastname
和 firstname
可以单独另存为数组变量。
"name":
{
"lastname": "Cummings”,
"firstname": “Alexander"
},
在管理中心的轮播配置中无法编辑数组或数组值。如需更改任何数据,必须在管理中心删除该数组并创建一个新数组。
{{customer.order}}
的值为空。其中,卡片 1 将显示为“订单号”的部分标题,卡片 2 则因生成的标题为空而不会显示。
Card 1
Title: Order number {{customer.order}}
Description: Here's your order {{product.description}}
Card 2
Title: {{customer.order}}
Description: Here's your order {{product.description}}
示例
{
"info": {
"count": 5,
"pages": 1
},
"results": [
{
"createdAt": "July 10, 2023",
"name": "Connie Stokes",
"Shippingaddress": "123 Street, City, State",
"order": {
"Status": "Ordered",
"Image": "https://images.pexels.com/photos/1484808/pexels-photo-1484808.jpeg"
},
"Quantity": 1,
"Price": 45,
"Item": "Shirt",
"id": "1"
},
…
本例使用进行 API 调用创建了数组变量,然后使用动态轮播向终端用户显示结果。
创建数组
- 在配置面板中,单击进行 API 调用。
- 输入 orders 作为名称。
- 在配置面板中,单击 API 详情。
- 单击请求方法下拉菜单,然后选择 GET。
- 输入 URL 作为端点 URL。
- 对于身份验证,选择您的身份验证方法。
有关更多信息,请参阅创建连接以与外部服务整合。
- 单击进行 API 调用。
- 单击结果旁边的保存。
- 从值下拉菜单中选择 Order,然后选择 Image。
使用默认变量名称 (image)。
- 单击添加项目,然后重复上述步骤,为 Order Status 和 Item 创建项目。
最多可添加 12 个项目(或键值对)。
- 单击保存。
- 在智能机器人生成器中,单击 API 调用成功下的添加步骤,然后选择添加轮播。
- 在配置面板中,单击转换为动态消息。
- 在数组下拉菜单中,单击结果。随即显示上面创建的数组。
- 对于标题,单击加号,选择 results.item。
对于标题和描述,您最多可以输入 128 个字符。
- 对于按钮链接,单击加号,选择 results.image。
- 对于按钮文本,单击加号,选择 results.status。
- 对于图像链接,单击加号,选择 results.image。
- 单击完成。
以下是一个动态轮播的例子。
关于步骤分支
进行 API 调用步骤是分支步骤。添加此步骤可根据 API 请求是否成功执行来拆分人工智能专员响应。
- API 返回 400 或 500 响应代码。
- 一个保存的变量缺失或带有
null
值。
在所有其他情况下,人工智能专员将沿成功分支下移。
69 条评论
Wes
Has something changed regarding saving array variables? Following along with the example in this article, the option to click "save" beside "results" isn't there. If you expand results you can save individual lines in that array, but there's no option to save the entire array.
0
Raphaël Péguet - Officers.fr
Hello
I saw while trying that when the flow builder API calls succeeds but finds an answer where ALL the saved variables are not present the flow builder takes the API failed path..
It's very unlogical :s
My use case is to use answer bot api into the flow builder. So i've saved as variables the url and the title of the 3 first articles. and every time the API calls finds 3 articles it works, but when it finds 1 or two articles the flow builder takes the "fail path"
0
Riat Abduramani
Hello,
I have a question: Have you considered incorporating variables into the ticket contexts? Currently, I don't see any provision for variables in the JSON payload `/api/v2/tickets/xxxxx.json`. Alternatively, it would be beneficial to use variables to populate custom fields.
Thank you.
0
Riat Abduramani
Hi,
I hope this message finds you well. I would like to address an issue regarding the current functionality of the Live Chat and Messaging tools. Previously, in Live Chat, we had the ability to set variables such as tags and custom fields before initiating a chat. This allowed us to enrich the ticket with relevant contextual data, such as order references, customer information, and the nature of the request through custom plugin apps.
However, with the introduction of the Messaging tool, we have noticed a limitation. The variables are now set from the Answer Bot and API call, and we are unable to set certain important information, such as the order reference, in the custom field. This means that we can only rely on the information provided by the customer, which can sometimes result in incorrect input.
To overcome this challenge, it would be extremely helpful for us to have the ability to set tags, variables, and custom fields once the ticket has been created, thereby obtaining the necessary context. It would be great if we could implement a similar functionality as shown below in the chat:
I hope this clarifies my requirement. Thank you for your attention to this matter.
Best regards,
0
John
Hi Dane,
The company sent me this link to everything, so I'm assuming I can do all of it? Would you mind seeing if it's possible?
https://www.shipstation.com/docs/api/orders/get-order/
0
Dane
You can check the option in Using the Make API call step in Flow Builder. Please take note that customization is not part of Zendesk's scope.
The step above is only possible if Shipstation has API endpoints where you can make the calls.
0
John
Greetings, I have Shipstation App linked to Support. I would like to use the bot Flowbuilder to allow people to check the status of their order (shipped, accepted, tracking #, ec.)
Is this where I do it and how would I program it? Thanks for any help!
0
Shiyu Zhu
Song Chen Our current timeline is 10 seconds and there is no ability to customize this right now.
Could you please elaborate what is the use case you are trying to achieve with ChatGPT? Thanks
0
Shiyu Zhu
Hey Carlton Kirk,
Alongside with exposing external_id, we are also exposing end-users email and name, does those attributes help you at all in identifying the user?
0
Song Chen
I am currently working on including an external API(ChatGPT) into our bot. I am trying to do a POST request, but having "Request Taking Too Long" troubles .
Can I setting the time out boundary in Zendesk call API?
0
登录 to leave a comment.