Fluent Commerce Logo
Docs
Sign In

Manual Event with Run-Once Workflow

How-to Guide

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


Step arrow right iconthe structure of a manual event

Here is the structure of a manual :

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}

Step arrow right iconGetting an event response

After replacing all the placeholders your can be sent against the {{fluentApiHost}}/api/v4.1//sync endpoint (using the corresponding retailer token) which will execute the included rules against the corresponding . 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}

Step arrow right iconExample Event to re-trigger a web hook rule

Example to re-trigger a web hook

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}








Fluent Commerce

Fluent Commerce