This article is also available in:
You can share information from your forms in Flokzu with external systems through webhooks.
Webhooks provide a notification mechanism to your app when a certain event happens so that you are able to take action on that. In Flokzu those events can be:

*Save
*Task completed

Action will depend on your external system and you will have to set up the URL to execute it.

Webhook type_save_

A webhook configured for the startevent will be executed every time one of this actions happen:

*At creating a new instance (whether that is a logged in user or a public form)
*At executing the autosave and the explicit save, only if the form was changed.

WebHook type task completed

A webhook configured for the task completed event will be executed every time a task is completed.

When a webhook will NOT be executed? Webhooks won’t be executed in process instances created and updated through Flokzu’s API, nor in tasks completed by a timer or conditional event.

Setting up webhooks

Webhooks can be enabled and configured for each process. To do so, go to the Configuration tab of the process in question and in the Webhooks section you will be able to enable it.

webhooks

There you will be able to configure the URLs that will be invoked when the different types of events occur as well as generate a token to add to the header of the call to provide security to it.

General format of the message sent to webhooks.

json
{
"Timestamp": "date of the event in UTC format",
"Type": "save o task_complete",
"Payload": "JSON according to the event"
}


Message format for a webhook of type save

In the property Payload of json the complete document that was modified will be sent.

The format will be as follows:

json
{
"tenantName": "tenant name",
"reference": "doc reference",
"documentCreator": "doc creator",
"dateCreated": "document creation date",
"info": " document summary",
"tags": ["tags of the document separated by comma"],
"downloadKey": "id document",
"fields": [
{"field 1": "value 1"},
{"field 2": "value 2"}
]
}


json contains the name of the tenant to which the document belongs, its reference, the creator of the document and the date it was created in ISO 8601 format.
You will also find the special fields summary (in the property info ) and tags (in the property tags), as well as the document ID (property downloadKey).

In the property fields you will find all the fields defined by the user and the values of these will be seen in the following way:

- 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 a json with the column name 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.

Example:

The following is an example of the json sent for a form with the following fields and values:

Field name | Data type | Value |
Email | email | nombre@mail.com |
Name | Text a line | John Doe |
Description | Multi-line text | Request for office stationery supplies|
Number of items | Integer | 2 |
Total amount | Decimal number | 3505.5 |
Date | Date | 06/08/2019 |
Time | Time | 15:30:00 |
City| Combo options | Madrid |
Form of payment | Radio Button | Counted |
Suppliers | Multiselection Combo | Bolimax, Rollerpen, TodoUSB |
Categories | Checklist | Stationery, Computers |
Order | Table |Product: Pen, Quantity:150, Price:750; Product: Flash Drive, Quantity:11, Price:2755.5|
Detail of the order | Attachment | |
Active account | Yes/No | Yes |
Web | Link | www.flokzu.com |
Number of items | Self-calculated | 3 |
Observations | Rich Text | Deliver to street 1234 from 08 to 18 hs.|

json sent:

json
{
"tenantName": "Flokzu",
"reference": "PED-14",
"documentCreator": "leandro@flokzu.com",
"dateCreated": "2019-08-06T17:17:10.223Z",
"info": "",
"tags: [""],
"downloadKey": "b45602d6467856c5b2a45973c49a99e2",
"fields: [
{"Email": "nombre@gmail.com"},
{"Name": "John Smith."}
{"Description": "Request for office stationery supplies"},
{"Number of items": "2"},
{"Total amount": "3505.5"},
{"Date": "06/08/2019"},
{"Time": "15:30:00"},
{"Department": "Madrid"},
{"Method of payment": "Cash",}
"{"Suppliers": "[Bolimax", "Rollerpen", "AllUSB",}
"{"Category": "[Stationery], "Computer science",}
{"Order": [
{"Product": "Pen",
"Quantity": "150"
"Price": "750",}
{"Product": "Pendrive",
"Quantity": "11"
"Price": "2755.5"}
]},
{"Detail of the order": {
"attachmentId: "badbf0e134604c54907ac960a5f862c9",
"name": "detalle.pdf",
"mimeType": 50,
"superType": 0,
"creationTime": "2019-08-06T17:16:08.479Z",
"size: 47939,
"lastEditedUtc": "",
"url": ""
}},
{"Active account": "true"},
{"Web": "www.flokzu.com"},
{"Number of items": "161"},
{"Observations":"<pstyle="text-align:center;\"><strong>Observaciones:</strong></p>\r\n<p style=\"text-align: center;\">&nbsp;</p>\r\n<p style=\"text-align: left;\">Deliver to street 1234 from 08 to 18 hs..</p>"}
]
}


Message format for a webHook task completedtype.

The json property Payload will send the task and the user who performed it.
At the same time it will be informed which action was carried out to complete the task and the corresponding date.
It will also have the information of the date in which the task was created (UTC format).
The format will be as follows:

json
{
"task_name": "name of the completed task",
"last_participant": "user who completed the task",
"last_action": "decision made for the task to be completed",
"reference": "doc reference",
"start_date": "date the task was created",
"end_date": "date the task was completed"
}


The active version doesn’t have a Retry Policy. To guarantee the integrity of your data when you implement it you must control that the last call realized doesn't over-write the previous data in the same instance, by controlling the timestamp event.
Was this article helpful?
Cancel
Thank you!