Webhooks

Usage overview

Webhooks are a way to proactively subscribe to events that occur in your KnowledgeOwl account. When an event occurs that you have subscribed to, we will POST a message to the endpoint of your specification containing information about the event.

Currently we offer 2 types of POST payloads, one formatted specifically for the application Slack, and the other containing KnowledgeOwl API object data.

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 webhoook, 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 
'{"event": "article.delete", "endpoint": "https://my.webhookconsumer.com/webhook-receive-new"}'
https://app.knowledgeowl.com/api/head/webhook/{{webhook ID}}.json

Available webhook events

Article Events:

  • article.create
  • article.publish
  • article.update
  • article.statusChange
  • article.delete

Comment Events:

  • comment.create
  • comment.update
  • comment.statusChange
  • comment.delete

Contact Form Events:

  • contactForm.submit

Have an event that you would like to receive notifications on that's not listed above? Contact our support team and let us know!