【问题标题】:Use Zapier to get comments in Zendesk使用 Zapier 在 Zendesk 中获取评论
【发布时间】:2021-09-25 19:47:17
【问题描述】:

我希望在 Zapier 中添加一个步骤,其中仅查找票证的 cmets。

Zendesk 文档显示了以下 curl,这在 Postman 中完美运行并返回指定票证的所有 cmets。

“Zapier 编码”功能需要我输入 javascript 或 python。

我也不太了解,使用转换为 Python 的 Curl,我得到 output_missing 请定义输出或提前返回。

我想检索 JSON 中“type”:“Comment”和“public”:false 的所有内容,

curl https://{subdomain}.zendesk.com/api/v2/tickets/{ticket_id}/comments.json \
  -H "Content-Type: application/json" -v -u {email_address}:{password}

如果有人能指出我正确的方向,将不胜感激。

代码如下:

import requests 
import json 

url = "domain.zendesk.com/api/v2/tickets/1234/comments.json" 
payload={} 
headers = { 
    'Content-Type': 'application/json', 
    'Authorization': 'Basic xxx' 
} 
response = requests.request("GET", url, headers=headers, data=payload) 
print(response.text)

【问题讨论】:

  • 代码在哪里?
  • import requests import json url = "domain.zendesk.com/api/v2/tickets/1234/comments.json" payload={} headers = { 'Content-Type': 'application/json', 'Authorization': 'Basic xxx' } response = requests .request("GET", url, headers=headers, data=payload) print(response.text)

标签: javascript python zapier zendesk


【解决方案1】:

您会在the docs 中注意到响应必须从代码中返回,而不仅仅是打印:

# ... your exist code

return response.json()

作为使用Code by Zapier 的替代方法,您可以尝试使用Webhooks by Zapier,这样您就可以轻松地向Zendesk 发出这个单一的请求。如果您查看“提出请求”操作。这里有详细说明:https://zapier.com/help/create/code-webhooks/send-webhooks-in-zaps#add-a-webhook-action

【讨论】:

  • 哇,我把它弄得很复杂! Webhooks 完全按照我的需要工作,谢谢!
猜你喜欢
  • 2022-10-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-01-31
  • 2016-03-21
  • 2014-01-23
  • 1970-01-01
相关资源
最近更新 更多