Using web hook actions

Integration

Deskpro can use a web hook action (as part of a trigger, escalation or SLA) to interact with external services that accept commands using the web’s HTTP protocol.

Many services offer HTTP APIs, so this provides a relatively simple way to have Deskpro interact with other software you use (or custom software your organization has developed). For example, if a suitable API is available, you could post a warning on your intranet when a ticket fails an SLA.

When the action runs, it sends an HTTP request using the HTTP method you specify from POST, GET, PUT and DELETE. A POST, PUT or DELETE request includes a representation of the relevant ticket in the request parameters. This enables the external service to use the information about the ticket. A GET request has an empty body.

See this Knowledgebase article for an example of the format.

Note that this option can only send data from Deskpro to an external service. If you want an external service to change data within your helpdesk, you will need to use the Deskpro API.

To create a web hook:

Select the Call Web Hook action type within a trigger, escalation, SLA or macro.

../_images/web-hook-action-select.png

Fill in the requested settings:

../_images/actions-webhook.png

  • URL means the URL where the external service accepts requests
  • username and password to authenticate with the external service (if required)
  • custom headers and data that will be included in the request (consult the documentation for the API/service you are using to select appropriate values for these)
  • timeout specifies how long in seconds Deskpro will wait for the HTTP request to be acknowledged by the external service before giving up.

Click Save.

Whenever the action runs, Deskpro will make the specified HTTP request.

To help with debugging, you can view the HTTP requests that an action is sending by using a tool such as RequestBin, to collect and display requests in a readable way. You will need to temporarily change the URL for the action to the address provided by RequestBin.

Using custom headers and data

You can send custom values in the HTTP headers by entering them in the Custom Headers field of the web hook action.

The format is:

X-Custom-Header: value
X-Custom-Header2: value2

You can also send custom data in the body of the post, to be included in the custom_data: parameter.

You can use variables to send particular properties of the ticket that triggered the action in the custom headers or data.

For example, when creating the web hook action you could enter a Custom header of:

X-Deskpro-TicketId: {{ ticket.id }}

Then the HTTP headers sent due to an action on the ticket with ID 5 would include “X-Deskpro-TicketId: 5”.

The syntax and possible values are the same as Deskpro uses for snippets in the agent interface and when sending messages with actions.

../_images/webhook-custom-headers-data.png

Ticket variables

{{ ticket.subject }}

Ticket subject.

{{ ticket.department.title }}

Ticket department name.

{{ ticket.product.title }}

Ticket product.

{{ ticket.category.title }}

Ticket category.

{{ ticket.workflow.title }}

Ticket workflow.

{{ ticket.priority.title }}

Ticket priority.

{{ ticket.id }}

Ticket ID.

{{ ticket.fieldX }}

Value of a custom ticket field (replace X with the field ID number).

{{ ticket.ref }}

Ticket ref code.

{{ ticket.date_created }}

Time and date ticket was created e.g. 2014-03-14 11:38:17.

User variables

.. describe:: {{ ticket.person.display_name }}

User’s name.

{{ ticket.person.primary_email.email }}

User’s email.

{{ ticket.person.organization.name }}

User’s organization.

{{ ticket.person.organization_position }}

User’s position in organization.

{{ ticket.person.fieldX }}

Value of a custom user field (replace X with the field ID number).

Agent variables

{{ ticket.agent.display_name }}

Agent name (or override name if set).

{{ ticket.agent.primary_email.email }}

Agent primary email.

{{ ticket.agent_team.name }}

Agent primary team.

Published: 24/03/2017

Last updated: 27/10/2017