Webhook API calls

Webhook API calls

GET LIST

List current webhook subscriptions for your account:

curl -u {{API key}}:x https://app.knowledgeowl.com/api/head/webhook.json

GET

Pull info for a specific webhook subscription by ID:

curl -u {{API key}}:x https://app.knowledgeowl.com/api/head/webhook/{{webhook ID}}.json

Example Response

{
  "valid": true,
  "data": {
    "id": "12345abcde",
    "type": "webhook",
    "status": "active",
    "output": "default",
    "project_ids": ["all"], //can also be array of Knowledge base IDs
    "event": ["article.create","article.update"],
    "endpoint":"https:\/\/my.webhookconsumer.com\/webhook-receive",
    "token": "98766abadada",
    "date_created": "06\/16\/2017 3:16 pm EDT",
    "date_modified": "06\/16\/2017 3:16 pm EDT",
    "date_deleted": null
  }
}

POST

Create a new webhook subscription:

Before you attempt to create a new webhook, make sure you have an endpoint that is ready to receive information and will return an HTTP status code of 200.

During the subscription creation, a test call will be made to your endpoint. If the endpoint you specify does not return an HTTP status code of 200, your webhook subscription will not be created.

JSON object sent during test call to provided endpoint when the output is set to "default":

{"type":"ping","data":{"object":{"webhook":"create"}}}

Single event:

curl -u {{API key}}:x -H "Content-Type: application/json" -X POST -d
'{"event": "article.delete", "endpoint": "https://hooks.slack.com/services/abcdefe123/abcd1234", "output": "slack"}'
https://app.knowledgeowl.com/api/head/webhook.json

Multiple events:

curl -u {{API key}}:x -H "Content-Type: application/json" -X POST -d 
'{"event": ["article.delete", "article.create"], "endpoint": "https://my.webhookconsumer.com/webhook-receive"}' 
https://app.knowledgeowl.com/api/head/webhook.json

PUT

Update a webhook subscription:

curl -u {{API key}}:x -H "Content-Type: application/json" -X PUT -d https://app.knowledgeowl.com/api/webhook.json"
'{"event": "article.delete", "endpoint": "https://my.webhookconsumer.com/webhook-receive-new"}'
https://app.knowledgeowl.com/api/head/webhook/{{webhook ID}}.json