Introduction and Goals

Webhooks are the link between actions in the front-end of the platform and workflow in the back-end of the application

Goals

  • Identify options for Webhooks
  • Learn to create and maintain webhooks
  • Learn to troubleshoot issues and track jobs

Webhooks Video

Webhooks

The most common use of a Webhook is to call a workflow process (Tree) when a Submission is created. However, that is just one of the uses for Webhooks.

Webhooks have a number of Types and Events that cause them to fire.

Kapps

In a Kapp, a Webhook can fire based on Events from both Forms and Submissions.

FormsSubmissions
CreatedClosed
DeletedCreated
RestoredSaved
UpdatedDeleted
Submitted (most common)
Updated

Space

In a Space, a Webhookcan fire based on Events from Datastore Forms, Datastore Submission, Discussion, Team, and User.

Datastore Form and Datastore Submissions are nearly the same as in a Kapp.

Here are the other Event Options:

DiscussionTeamUserSpace
Discussion CreatedCreatedLoginLogin Failed
Invitation CreatedUpdatedLogout
Invitation UpdatedDeletedCreated
NotificationRestoredUpdated
Membership ChangeDeleted
Membership Change

Creating and Maintaining

Every Webhook is comprised of the same parts

Name

A descriptive name used for Reference.

Type and Event

See the tables above for options.

Filter

Used to restrict when the Webhook fires. Like all the other condition fields, a javascript expression needs to evaluate to true or flase. By default, a blank filter evaluates to true. Variables are available (attributes, slugs, etc) depending on context.

For example, here is the condition for the Submission Submitted - Custom Form Webhook:

form('attribute:Custom Submission Workflow').indexOf('Submitted') > -1

URL

Location and callback definition of the application being called. In kinops it references a task tree using the API.

Webhook Jobs

There are three tabs available for looking at Webhook jobs. Each one has a different purpose.

All History

As you can guess from the name, this is every Webhook job starting from the most recent. You can click on the Name (Webhook name) to see the Webhook, or click on the Summary (HTTP Status Codes) to see the specifics of the job.

Example Job:

V5-Webhook Job Summary

Failures

Again, the name is descriptive of the intent of the console. This tab shows any failures, along with any response returned.

Example Failure (URL was edited to be incorret):

V5 Webhook Job Failure

See the Error under the Summary, and the explanation in the Response Content field.

Pending

Retrying a Webhook Job that has failed will put it on the Pending queue. You can make some adjustments to the data to help your troubleshooting.

Example Pending:

V5-Webhook Job Pending

In the Next Article

We'll move to the workflow process and look at Loops in Task Trees.

Story for this Class

The Cleaning Request created in the previous classes is OK, but now we need to improve the User Experience and Workflow.