Webhooks
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.
Forms | Submissions |
---|---|
Created | Closed |
Deleted | Created |
Restored | Saved |
Updated | Deleted |
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:
Discussion | Team | User | Space |
---|---|---|---|
Discussion Created | Created | Login | Login Failed |
Invitation Created | Updated | Logout | |
Invitation Updated | Deleted | Created | |
Notification | Restored | Updated | |
Membership Change | Deleted | ||
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:
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):
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:
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.
Updated over 3 years ago