通过 PostMan 注册传出 Webhook 时出现“403”错误
Getting "403" error while registering an Outgoing Webhook via PostMan
URL :
我的 Headers :
- Content-Type : application/x-www-form-urlencoded
- Authorization : Bearer ot-xxxxxxxxxxxx
Body :
- url - Some URl
- filter - CONVERSATION.CREATE
我得到的错误:
"The permission to access this resource is not granted. Scopes ::= [ALL, READ_CONVERSATIONS, READ_USER]"
Plus If i want to send extra filters thn will it be comma separated values?
确保您的应用注册包含您的应用要求的范围。对于简单的传出 webhook 注册,您只需要范围 READ_CONVERSATIONS.
有关如何注册 webhook 的示例,请参阅 https://github.com/circuit/circuit-REST-bot/blob/master/app.js。此示例注册 CONVERSATION.ADD,但 CONVERSATION.CREATE 非常相似。
如果您仍然有问题,请 post 一个代码示例,甚至 link repl.it 上的应用程序。
这是一个注册 webhook 的 HTTP 请求示例。请注意 body 作为 text/plain 发送(这是默认值,其 header 可以省略)。另请注意,回调 url 是 http。尚不支持 https。
POST https://circuitsandbox.net/rest/v2/webhooks HTTP/1.1
Host: circuitsandbox.net
Content-Type: text/plain
Authorization: Bearer <token>
url=http://90587c6d.ngrok.io/webhook&filter=CONVERSATION.CREATE
这是一个 curl 命令
curl -X POST https://circuitsandbox.net/rest/v2/webhooks -H "Authorization: Bearer <token>" -d "url=http://90587c6d.ngrok.io/webhook&filter=CONVERSATION.CREATE"
如果您收到 403,我会怀疑范围错误(如 Roger 所述)或身份验证问题。
首先,请向我们展示当前为该应用选择了哪些范围;对于身份验证,您能否检查是否可以成功进行其他 API 调用?
这是 Postman 中的样子
URL :
我的 Headers :
- Content-Type : application/x-www-form-urlencoded
- Authorization : Bearer ot-xxxxxxxxxxxx
Body :
- url - Some URl
- filter - CONVERSATION.CREATE
我得到的错误:
"The permission to access this resource is not granted. Scopes ::= [ALL, READ_CONVERSATIONS, READ_USER]"
Plus If i want to send extra filters thn will it be comma separated values?
确保您的应用注册包含您的应用要求的范围。对于简单的传出 webhook 注册,您只需要范围 READ_CONVERSATIONS.
有关如何注册 webhook 的示例,请参阅 https://github.com/circuit/circuit-REST-bot/blob/master/app.js。此示例注册 CONVERSATION.ADD,但 CONVERSATION.CREATE 非常相似。
如果您仍然有问题,请 post 一个代码示例,甚至 link repl.it 上的应用程序。
这是一个注册 webhook 的 HTTP 请求示例。请注意 body 作为 text/plain 发送(这是默认值,其 header 可以省略)。另请注意,回调 url 是 http。尚不支持 https。
POST https://circuitsandbox.net/rest/v2/webhooks HTTP/1.1
Host: circuitsandbox.net
Content-Type: text/plain
Authorization: Bearer <token>
url=http://90587c6d.ngrok.io/webhook&filter=CONVERSATION.CREATE
这是一个 curl 命令
curl -X POST https://circuitsandbox.net/rest/v2/webhooks -H "Authorization: Bearer <token>" -d "url=http://90587c6d.ngrok.io/webhook&filter=CONVERSATION.CREATE"
如果您收到 403,我会怀疑范围错误(如 Roger 所述)或身份验证问题。 首先,请向我们展示当前为该应用选择了哪些范围;对于身份验证,您能否检查是否可以成功进行其他 API 调用?
这是 Postman 中的样子