Skip to main content

Create

Description#

Use a HTTP POST request to create an action.

Request#

HTTP Method: POST

ParameterDescription
typeType of action to create:
Agents::EmailAgent
Agents::EventTransformationAgent
Agents::HTTPRequestAgent
Agents::IMAPAgent
Agents::TriggerAgent
Agents::WebhookAgent
Agents::SendToStoryAgent
nameName of the action.
optionsJSON Options block of the action.
positionAn object describing the XY coordinates of the action on the story diagram.
disabledBoolean flag indicating whether action is disabled.
story_idID of story to which the action should be added.
source_idsArray of action IDs the action should receive emitted events from.
receiver_idsArray of action IDs the action should emit events to.
scheduleAn object defining the cron schedule for the action.
monitor_failuresBoolean flag indicating if a notification should be sent when this action fails.
monitor_all_eventsBoolean flag indicating if all events should be monitored.
monitor_no_events_emittedDuration in seconds. If no events are emitted in this time, a notification will be sent.

Sample request#

curl -X POST \  https://<tenant-domain>/api/v1/agents/<action-id> \  -H 'content-type: application/json' \  -H 'x-user-email: <email-address>' \  -H 'x-user-token: <api-token>'  -d '{        "type":"Agents::EventTransformationAgent",        "name": "Extract email addresses and urls",        "story_id":1,        "source_ids": [100, 102],        "receiver_ids":[],        "position": {"x": 100, "y": 200},        "options":{          "mode": "extract",          "matchers": [            {              "path": "{{.text}}",              "regexp": "\\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}\\b",              "to": "email_addresses"            },            {              "path": "{{.text}}",              "regexp": "https?:\\/\\/[\\S]+",              "to": "urls"            }          ],          "message": "This is an optional message"        }      }'

Response#

A successful request will return a JSON object describing the created action.

Field description#

ParameterDescription
idAction ID.
typeAction type
user_idUser ID of the action's owner.
optionsJSON Options block of the action.
nameName of the action.
scheduleAn object defining the cron schedule for the action.
events_countNumber of events action has emitted.
last_check_atISO 8601 Timestamp representing date and time of action's last scheduled run.
last_receive_atISO 8601 Timestamp representing date and time of last event received.
created_atISO 8601 Timestamp representing creation date and time of action.
updated_atISO 8601 Timestamp representing last updated date and time of action.
last_event_atISO 8601 Timestamp representing date and time the last event was received.
last_error_log_atISO 8601 Timestamp representing date and time of last error thrown by the action.
disabledBoolean flag indicating whether action is disabled.
guidUnique identifier of the action.
positionAn object describing the XY coordinates of the action on the story diagram.
story_idID of story to which the action belongs.
team_idID of story to which the action belongs.
sourcesAn Array of Action IDs this action receives emitted events from.
receiversAn Array of Action IDs this action emits events to.
monitor_failuresBoolean flag indicating if a notification should be sent when this action fails.
monitor_all_eventsBoolean flag indicating if all events should be monitored.
monitor_no_events_emittedDuration in seconds. If no events are emitted in this time, a notification will be sent.

Sample response#

{  "id": 73563,  "type": "Agents::EventTransformationAgent",  "user_id": 167,  "options": {    "mode": "deduplicate",    "path": "{{.propagation_webhook.password}}",    "lookback": "1"  },  "name": "Deduplicate",  "schedule": [    {      "cron": "*/1 * * * *",      "timezone": "Europe/Dublin"    }  ],  "events_count": 2,  "last_check_at": "2021-05-07T11:46:50Z",  "last_receive_at": "2021-05-07T11:46:50Z",  "created_at": "2021-05-07T11:42:58Z",  "updated_at": "2021-05-07T11:47:00Z",  "last_event_at": "2021-05-07T11:47:00Z",  "last_error_log_at": null,  "disabled": false,  "guid": "f3fe6f8e167c9db42e64eaef8e5d2f0c",  "position": {    "x": -945,    "y": 450  },  "receivers": [70118],  "sources": [70116],  "story_id": 807,  "team_id": 335,  "monitor_failures": true,  "monitor_all_events": true,  "monitor_no_events_emitted": 86400}