What is a Webhook?

Webhooks are a method by which an external service can be notified when a record is created, updated or deleted. They can also be used to receive notifications when certain actions are performed on a record (e.g. an activity is completed, an opportunity is converted to an order etc.).

Whenever one of these events occurs an action is created within current. As part of the creation of the action, any webhooks that are associated with that event will be fired. Each webhook defines a target URL. When the event occurs, a POST request will be made to that URL. The body of the request will consist of a JSON representation of the action that triggered the webhook.

Creating a webhook

Before creation, it is first necessary to enable the webhooks functionality. This can be done from System Setup > Company Information.

Webhooks must be created using the API - please refer to our API Documentation for more information on this.

A webhook has four key attributes:

  • Name - a descriptive name you would like associated with the webhook

  • Event - the action log event that will trigger the webhook

  • Target URL - the external address you want the POST request sent to

  • Active flag

The Name, the Event and the Target URL attributes are mandatory. The Active flag attribute is optional and will default to TRUE if a value is not provided when the webhook is created.

A sample body for the POST request to create a webhook should look like this:

{
"Webhook": {
"name":"Create an invoice",
"event":"invoice_create",
"target_url":"https://mywebhook.com/handler",
"active":true
}
}

Webhook events

The “event” attribute combines a subject type and action type into a single string. The subject type and action type are both in lowercase and joined by an underscore character.

There are six generic action types which apply to most subjects:

  • create

  • update

  • destroy

  • discuss - raised when a discussion is created on a subject

  • attach - raised when an attachment is added to a subject

  • detach - raised when an attachment is removed from a subject

  • custom_view_export

In addition to these generic actions, many subjects have specific actions that can be hooked.

As an example, you would use activity_create as your “event” value if you wanted a webhook executed when a new activity was created in Current RMS. Alternatively you could use activity_discuss to hook the addition of a discussion to an activity. If you wanted to capture the addition of comments to the new discussion you would need discussion_comment.

Further information on this can be found on the specific subject pages linked below:

Looking for further information on Webhooks?

Check out the guide below.

Did this answer your question?