You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: fern/docs/pages/references/functions.mdx
+46Lines changed: 46 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,52 @@ functions:
27
27
- `name`: It is the function name that should match the corresponding function name in the folder.
28
28
- `description`: It describes the function.
29
29
30
+
### Synchronous execution with synchronization key
31
+
32
+
To ensure that function executions are processed in order, FIFO, for a given context such as a user or conversation, enable synchronization support in your function’s manifest and use a synchronization key, sync_id.
33
+
34
+
The platform uses the sync_id as the message group for FIFO processing. This ensures that all executions with the same sync_id are processed in order, preventing race conditions or duplicate conversations.
35
+
Use cases for synchronous execution include:
36
+
37
+
- Ensuring order of message processing for chatbots or messaging integrations.
38
+
- Preventing duplicate or out-of-order actions when multiple events are triggered.
39
+
40
+
To enable this:
41
+
42
+
1. Enable synchronization in manifest
43
+
- In your function’s manifest, add the field:
44
+
```yaml
45
+
functions:
46
+
- name: function_name
47
+
description: Let me execute
48
+
supports_synchronization: true
49
+
```
50
+
- This tells the platform to use a FIFO queue for this function.
51
+
52
+
1. Set the synchronization key
53
+
- When triggering an automation, include the sync_id in your rego policy along with the `event_key`. For example:
0 commit comments