Links

Workflow Dataslots

Config dataslots have different access types inside an application. There are two access types of a config dataslots:
  • Application (global)
  • Workflow (specific to a workflow)
So far, we have worked with application access-type config dataslots. The application config dataslots are global and can be accessed by any workflow, while workflow dataslots are only specific to a workflow
Let's look at an example below where we have created two dataslots
  • List of channels (application)
  • List of channels (workflow)
Setting config and workflow dataslots
The response of .config() function will display both the dataslots. The workflow dataslots will load inside the workflow object of the response. See below:
{
"application_data_slots": [
{
"required": false,
"id": "644e14149aac4fbbe6899ad1",
"name": "List of channels (application)",
"has_dynamic_map_fields": false,
"field_type": "select",
"options": [
{
"name": "general",
"value": "C044U7Q074J"
},
{
"name": "testing-account",
"value": "C04737EBUH5"
},
{
"name": "cobalt-demo-channel",
"value": "C04SQ0H90M8"
},
{
"name": "admin",
"value": "C057R9JQ3AN"
}
],
"dynamic_slot_identifier": "dynamic:slack:3",
"labels": []
}
],
"workflows": [
{
"id": "63ea0610085cbdc8837b29a6",
"name": "Send message",
"icon": "",
"data_slots": [
{
"id": "64633b8cc7f3ab6e2bf5061a",
"name": "List of channels (workflow)",
"required": false,
"has_dynamic_map_fields": false,
"field_type": "select",
"options": [
{
"name": "general",
"value": "C044U7Q074J"
},
{
"name": "testing-account",
"value": "C04737EBUH5"
},
{
"name": "cobalt-demo-channel",
"value": "C04SQ0H90M8"
},
{
"name": "admin",
"value": "C057R9JQ3AN"
}
],
"dynamic_slot_identifier": "dynamic:slack:3",
"labels": []
}
],
"enabled": false
}
],
"config_id": "1234"
}

Updating a workflow dataslot

Let's see how do you update the value of a workflow dataslot using updateConfig() function:
cobalt.updateConfig('slack','1234',{
"config_id": "1234",
"application_data_slots": {},
"workflows": [
{
"id": "63ea0610085cbdc8837b29a6", //workflow id
"enabled": true, //make sure you set the enabled to true to run a workflow
"data_slots": {
"64633b8cc7f3ab6e2bf5061a" : "C04SQ0H90M8"
//[response.workflows[0].data_slots[0].id] : [response.workflows[0].data_slots[0].options[2].value]
}
}
]
});