1. Stubmation
  2. Run Stub Action from JSON

Stubmation

Run Stub Action from JSON

Runs an action on a stub for each Object in a JSON Array.

This stubmation workflow enables the user to run a stub action for each Object in a JSON Array of objects.

This uses the same stubmation as Run Stub Action per row from Sheet with some small differences.

INFO

A scenario for this could be:

  • You have a list of customers, their names and cell numbers are in a JSON array.
  • Each customer's data is in its own object with-in the JSON array.
    • You could have used the Read From Sheet task to read this info from a Google Sheet.
  • You would like to create a stub for each customer that will send them a WhatsApp and start a conversation

This stubmation will enable you to upload the CSV file and do that.

What Happens behind the scenes

The stubmation will use the data passed to it via the json_data array, cycle through the array and run the stub action via webhook, as defined in trigger_stubaction, with the object's data injected into object defined in inject_data_object.

In our example below, the action create_stub_via_webhook action will be run on stubref ~~stub.stubref. The create_stub_via_webhook action has been defined in the template to use the incoming data and run the Create Stub task to create the new stub.

It will then pause for the duration as defined in delay_per_row_seconds, before it moves to the next line's data to run the stub action.

When all lines are processed, it will automatically stop.

Run Stub Action per row from JSON

loading...

Flow Data Explained

json_data
required
array

The JSON data the will be passed to stubmation for processing. This can be explicitly added in or you can use Value replacement substitution to use data from a variable in stub.data or stubpost.tasks.task_name.payload.result. Ensure the data returned is a JSON Array of Objects.


delay_per_row_seconds
optional
string

Default: 5

This is the time in seconds the workflow will pause between triggering the stub action for each row of data.


trigger_stubaction
required
json object

Contains all the details of the action that needs to be triggered. These action are triggered via webhook, so the action needs to be Webhook enabled. If the action's webhook has authentication enabled, the authentication should be correct for the action being called.


trigger_stubaction.stubref
required
string

The stubref for the stub the action needs to run on.


trigger_stubaction.action_name
required
string

The name of the webhook enabled action that the stubmation workflow needs trigger.


trigger_stubaction.inject_data_object
optional
string

Default: row_data
The name of the json object the row data will be injected into at stubpost.data.payload. eg.

loading...

trigger_stubaction.authorization
optional
json object

Contains Webhook authorization data, should the action's webhook the stubmation workflow is to call, require authorization


trigger_stubaction.authorization.type
optional
string

The type of authorization the actions's webhook is configured for.


trigger_stubaction.authorization.keys
optional
json object

Contains the keys used to authorize the webhook call


trigger_stubaction.authorization.keys.token
optional
string

The token used in Bearer type authorization

Duplicate Detection

This will allow you to specify json data key names who's values will be hashed and stored.

When the process runs, it check if the hash exists in the hash store.

  • If the hash does exist, it simply does not run the action on the stub and discards the job.
  • If the hash does not exist, it creates and stores the hash and then runs the action.
loading...

Flow Data Explained

Showing the additional parameters required for duplicate detection.


trigger_stubaction.duplicate_detection
required
json object

Contains the keys used for duplicate detection


trigger_stubaction.duplicate_detection.enable
required
boolean

Instructs the workflow to store duplicate detection data and to detect for duplicates.


trigger_stubaction.duplicate_detection.columns_to_hash
required
JSON Array

This is an array of the json data key names, who's combined contents, will be hashed and stored for duplicate detection.

The duplicate detection is only stored for 4 days. It is then automatically removed.

These names should be as they appear in the json object(s) in the json_data array being passed.