Manual Event with Run-Once Workflow
Author:
Fluent Commerce
Changed on:
13 Dec 2023
Key Points
- The Fluent platform allows sending events with a workflow "attached" in the meta section of the event. This means that Rubix will execute the rulesets and rules which have been passed through as part of the event. This is especially useful to manually execute particular rules on an entity and is mostly used for operational purposes.
Steps
the structure of a manual event
Here is the structure of a manual event:
1{
2 "accountId": "{{accountId}}",
3 "retailerId": "{{retailerId}}",
4 "name": "{{eventName}}", // needs to be the same as below
5 "entityType": "{{entityType}}",
6 "entityId": "{{entityId}}", // for legacy entities
7 "entityRef": "{{entityRef}}", // for new entities
8 "meta" : {
9 "workflow" : {
10 "retailerId": "{{retailerId}}",
11 "version": "1.0",
12 "rulesets": [
13 {
14 "name": "{{eventName}}", // needs to be the same as above
15 "type": "{{entityType}}",
16 "eventType": "NORMAL",
17 "rules": [
18 {{...rules}}
19 ],
20 "triggers": [], // left blank to cover all statuses
21 "userActions": []
22 }
23 ]
24 }
25 }
26}
Language: json
Name: Event structure
Description:
[Warning: empty required content area]Getting an event response
After replacing all the placeholders your event can be sent against the {{fluentApiHost}}/api/v4.1/event/sync endpoint (using the corresponding retailer token) which will execute the included rules against the corresponding entity. If the execution was successful you will get a standard response for example:
1
2{
3 "eventId": "09cb96b0-4247-11ea-9156-2d5aab27a8a1",
4 "entityId": "143",
5 "eventStatus": "COMPLETE"
6}
Language: json
Name: event response
Description:
[Warning: empty required content area]Example Event to re-trigger a web hook rule
Example Event to re-trigger a web hook rule
1
2{
3 "name":"SendCustomWebhook",
4 "accountId": "{{accountId}}",
5 "retailerId": "1",
6 "entityType": "FULFILMENT",
7 "entityId": "143",
8 "meta": {
9 "workflow": {
10 "retailerId": "1",
11 "version": "1.0",
12 "entityType": "FULFILMENT",
13 "rulesets": [
14 {
15 "name": "SendCustomWebhook",
16 "type": "FULFILMENT",
17 "eventType": "NORMAL",
18 "rules": [
19 {
20 "name": "{{accountId}}.{{pluginNamespace}}.SendCustomWebhook",
21 "props": {
22 "webhook_url": "https://demo7097622.mockable.io/webhook",
23 "webhook_name": "ORDER_CREATED"
24 }
25 }
26 ],
27 "triggers": [],
28 "userActions": []
29 }
30 ]
31 }
32 }
33}
Language: json
Name: Manual Event
Description:
[Warning: empty required content area]