Getting "403" error while registering an Outgoing Webhook via PostMan

2.3k views Asked by At

URL :

https://circuitsandbox.net/rest/v2/webhooks

My Headers :

  • Content-Type : application/x-www-form-urlencoded
  • Authorization : Bearer ot-xxxxxxxxxxxx

Body :

  • url - Some URl
  • filter - CONVERSATION.CREATE

Error I am getting :

"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?

3

There are 3 answers

1
samo On BEST ANSWER

If you are getting a 403, I would suspect a scope error (as mentioned by Roger) or an authentication problem. For the first, please show us which scopes are currently selected for the application ; for authentication, can you check if you can make other API calls successfully ?

Here is what it looks like in Postman

enter image description here

enter image description here

2
Roger Urscheler On

Make sure your app registration contains the scopes that your app is asking for. For a simple outgoing webhook registration you would only need the scope READ_CONVERSATIONS.

See https://github.com/circuit/circuit-REST-bot/blob/master/app.js for an example on how to register for a webhook. This example registers for CONVERSATION.ADD, but CONVERSATION.CREATE is very similar.

If you still have problems please post a code example, or even a link to an app on repl.it.

5
Roger Urscheler On

Here is an example HTTP request to register the webhook. Note that the body is sent as text/plain (which is the default and its header can be omitted). Also note that the callback url is http. https is not yet supported.

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

and here is a curl command

curl -X POST https://circuitsandbox.net/rest/v2/webhooks -H "Authorization: Bearer <token>" -d "url=http://90587c6d.ngrok.io/webhook&filter=CONVERSATION.CREATE"