> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://docs.flokzu.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Webhooks

In Flokzu, you can share the information contained in your forms with external systems through webhooks.
Webhooks provide a mechanism to notify your application when a specific event occurs, allowing you to take actions and maintain a complete trace of what happens in the instance.

There are four types of events:

### 1 - *Save* Webhook

A webhook configured for the save event will be triggered when any of the following actions occur:
* Creating a new instance (whether executed by a logged-in user, from a public form, or from the Flokzu API)
* When autosave or explicit save is executed, provided changes were made to the form.

### 2 - *Task Completed* Webhook

This is sent when a task is completed, whether manually or through an interrupting timer or conditional event.
Keep in mind that non-interrupting timers or conditional events generate additional flows without completing the task in progress.

### 3 - *Delete* Webhook

Allows notifying external systems when an instance is deleted from Flokzu.

### 4 - *Event Triggered* Webhook

This webhook is sent when non-interrupting timers or conditional events are executed. This type of event moves the instance along an additional path in the workflow, without completing the active User Task.


# Configuring Webhooks

Webhooks can be enabled and configured for each process. To do so, go to the **Process** **Settings** tab of the process, and in the **Webhooks** section you'll be able to enable them.
There you can configure the URLs that will be called when the different types of events occur, as well as generate a token to add security.


![](https://storage.crisp.chat/users/helpdesk/website/-/c/c/c/3/ccc3fbb5dc442800/image_e20mq5.png)

### General message format sent to webhooks

```javascript
{ 
  "Timestamp": "Date the event occurred, in UTC format",
  "Type": "save, task_complete, event_triggered, or delete",
  "Payload": "JSON according to the event"
}
```


|| Each webhook includes a `timestamp` indicating the date and time the event occurred. It is the receiving system's responsibility to use this value to validate the order of events and ensure data integrity. This is especially important given possible delivery delays, since a webhook corresponding to an earlier event could arrive after a more recent one — and if processed without validating the timestamp, it could overwrite more up-to-date information.


### Message format for a *Save* webhook

The Payload property of the JSON will contain the complete document that was modified.
The format will be as follows:


```javascript
{
  "tenantName": "tenant name",
  "reference": "document reference",
  "documentCreator": "document creator",
  "dateCreated": "document creation date in ISO 8601 format",
  "info": "document summary",
  "tags": ["comma-separated document tags"],
  "downloadKey": "document id",
  "fields": [
                   {"field 1": "value 1"},
                   {"field 2": "value 2"}	
   ]
}
```

In the fields property you'll find all the fields defined by the user, and their values will appear as follows:


* **Email, one line text, multilinear text, link, integer, decimal, auto-calculated, date and time**, show the value exactly as they are in the document.
* **Combo box and radio button**, show the selected value.
* **Multi-selection combo and checklist**, show an array with the selected options and separated by inverted commas.
* **Table**, shows table name, and then for each record, the columns and its correspondent value.
* **Attachment**, shows info related to it such as name, attachment id, date of creation and more.
* **Yes/No**, shows true if the selected option is yes and false if not.
* **Rich text**, shows the content of the field with its correspondent tags to generate the same content as in the Flokzu document.
* **Signature**, not supported.


###### Example

Below is an example of the JSON sent for a form with the following fields and values:

Here's the translated example table with an updated JSON to match:


| Field name | Data type | Value |
| ---- |
| Email | Email | name@mail.com |
| Name | Single-line text | John Smith |
| Description | Multi-line text | Request for office stationery supplies |
| Number of items | Integer | 2 |
| Total amount | Decimal | 3505.5 |
| Date | Date | 08/06/2019 |
| Time | Time | 15:30:00 |
| City | Combo box | Madrid |
| Payment method | Radio button | Cash |
| Suppliers | Multi-select combo | Bolimax, Rollerpen, TodoUSB |
| Categories | Checklist | Stationery, IT |
| Order | Table | Product: Pen, Quantity: 150, Price: 750; Product: Flash drive, Quantity: 11, Price: 2755.5 |
| Order details | Attachment | details.pdf |
| Active account | Yes/No | Yes |
| Website | Link | www.flokzu.com |
| Item count | Auto-calculated | 161 |
| Notes | Rich text | Ship to 1234 Main Street between 8 AM and 6 PM. |
  	

JSON sent:

```javascript
{
   "tenantName": "My company",
   "reference": "PED-14",
   "documentCreator": "sales@mycopany.com",
   "dateCreated": "2027-08-06T17:17:10.223Z",
   "info": "",
   "tags": [""],
   "downloadKey": "b45602d6467856c5b2a45973c49a99e2",
   "fields": [
                {"Email": "name@mail.com"},
                {"Name": "John Smith"},
                {"Description": "Request for office stationery supplies"},
                {"Number of items": "2"},
                {"Total amount": "3505.5"},
                {"Date": "08/06/2027"},
                {"Time": "15:17:00"},
                {"City": "Madrid"},
                {"Payment method": "Cash"},
                {"Suppliers": "[\"Bolimax\",\"Rollerpen\",\"TodoUSB\"]"},
                {"Categories": "[\"Stationery\",\"IT\"]"},
                {"Order": [
                            {"Product": "Pen",
                             "Quantity": "150",
                             "Price": "750"},
                            {"Product": "Flash drive",
                             "Quantity": "11",
                             "Price": "2755.5"}
                           ]},
                {"Order details": {
                                "attachmentId": "badbf0e134604c54907ac960a5f862c9",
                                "name": "details.pdf",
                                "mimeType": 50,
                                "superType": 0,
                                "creationTime": "2027-08-06T17:16:08.479Z",
                                "size": 47939,
                                "lastEditedUtc": "",
                                "url": ""
                                    }},
                {"Active account": "true"},
                {"Website": "www.flokzu.com"},
                {"Item count": "161"},
                {"Notes": "<p style="text-align: center;"><strong>Notes:</strong></p>\r\n<p style="text-align: center;">&nbsp;</p>\r\n<p style="text-align: left;">Ship to 1234 Main Street between 8 AM and 6 PM.</p>"}
              ]
}
```


### Message format for a *Task Completed* webhook

The Payload property of the JSON will contain the data of the completed User Task and its associated trace.
The format will be as follows:

```javascript
{
  "task_name": "name of the completed task",
  "last_participant": "user who completed the task",
  "last_action": "decision made (button) that completed the task",
  "reference": "document reference",
  "start_date": "date the task was created, in UTC",
  "end_date": "date the task was completed, in UTC"
}
```


### Message format for an *Event Triggered* webhook

The Payload property of the JSON will contain information related to the non-interrupting event that was executed.

```javascript
{
  "event_name": "name of the triggered event",
  "reference": "document reference",
  "triggered_date": "date the event was executed, in UTC"
}
```


### Message Format for a Delete Webhook

The Payload property of the JSON will contain information related to the deleted document.

```javascript
{
  "tenantName": "tenant name",
  "reference": "document reference",
  "documentCreator": "document creator",
  "dateCreated": "document creation date",
  "info": "document summary",
  "tags": ["comma-separated document tags"],
  "downloadKey": "document id",
  "fields":  [
               {"field 1": "value 1"},
               {"field 2": "value 2"}	
  ]
}
```


### Testing Webhooks

To test how webhooks work, you can go to [https://webhook.site/](https://webhook.site/). This site will give you a URL for your tests that you can configure in Flokzu, letting you view the format of the message sent directly from the platform.



