trigger.find

The trigger.find command is used to find and return a trigger.

TR50 Request

// find by id
{
  "cmd": {
    "command": "trigger.find",
    "params": {
      "id": "53728d6b31004662fe000052"
    }
  }
}
// find by name
{
  "cmd": {
    "command": "trigger.find",
    "params": {
      "name": "trigger_name"
    }
  }
}

Request Parameters

Name Type Required Description
id String Yes* The unique identifier to find.
name String The name of the trigger.

*One of the above fields must be used to find the trigger

TR50 Response

If the command is sent successfully a success message and the result is returned. Otherwise, an error and error message will be returned.

{
  "cmd": {
    "success": true,
    "params": {
      "id": "58e6a81ef0cd7e2ab800016a",
      "orgId": "560ef49c681fdc7d1f015605",
      "orgKey": "DEMO",
      "name": "Get SMS",
      "started": false,
      "eventType": "twilio.sms.receive",
      "event": {
        "phoneNumber": "+15615294890"
      },
      "reportMode": "On",
      "reportUntil": "2018-01-01T00:00:00Z",
      "actions": {
        "0": {
          "type": "twilio.sms.send",
          "params": {
            "body": "I got an SMS",
            "to": "9542493829"
          },
          "canvas": {
            "failure": "failure-end0",
            "left": "51",
            "success": "success-end0",
            "top": "182"
          },
          "routes": {
            "failure": "$endFailure",
            "success": "$endSuccess"
          }
        }
      },
      "firstAction": "0",
      "canvas": {
        "event": {
          "left": "50",
          "top": "50"
        },
        "failure-end": {
          "0": {
            "left": "41",
            "top": "275"
          }
        },
        "success-end": {
          "0": {
            "left": "163",
            "top": "275"
          }
        }
      },
      "successCount": 0,
      "failureCount": 0,
      "dailySuccessCount": 0,
      "dailyFailureCount": 0,
      "lastSuccess": "0001-01-01T00:00:00Z",
      "lastFailure": "0001-01-01T00:00:00Z",
      "createdBy": "john.doe@telit.com",
      "createdOn": "2017-04-06T16:42:06.418-04:00",
      "updatedBy": "john.doe@telit.com",
      "updatedOn": "2017-12-01T16:42:06.418-04:00"
    }
  }
}

Response Parameters

Name Type Description
id String The unique identifier of the trigger.
orgId String The ID of the org.
orgKey String The key of the org.
name String The name of the trigger.
desc String The description of the trigger.
started Boolean Whether the trigger has been started.
eventType String The trigger event type.
event String The event object. Parameters depend on the eventType. Refer to the trigger.event.list call.
reportMode String Off - No trigger events will be reported

On - All trigger events will be reported. When On is selected the all trigger events are reported for the next 30 days and later it automatically switches to the default On failure mode.

On failure(default) - Only events that failed will be reported.

reportUntil String The reportUntil applies only when reportMode in On and provides the date/time when the reportMode will switch to On failure(default)
startedOn Timestamp The date & time when the trigger was last started.
stoppedOn Timestamp The date & time when the trigger was last stopped.
actions Array Array of action objects. See table below. Parameters depend on each action's type. Refer to the trigger.action.list call.
firstAction String Identifier of the first action that takes place.
canvas Array Canvas information of where the event, failure-end, and success-end elements are placed.
successCount Integer Number of times the trigger has been successfully executed.
dailySuccessCount Integer Number of times the trigger has been successfully executed today.
lastSuccess String Timestamp of the last successful execution associated with this trigger.
failureCount Integer Number of times the trigger has failed during execution.
dailyFailureCount Integer Number of times the trigger has failed during execution today.
lastFailure String Timestamp of the last failed execution associated with this trigger.
dailySuccessCount Integer Number of successes for the current day.
dailyFailureCount Integer Number of failures for the current day.
execTime Integer Time trigger took to last execute.
activeWindow Array Array of day/hour values of when the trigger can run. The key of the array is in the format "DH:<day>:<hour>". Where <day> is represented by 0-6 (0 for Sunday, 1 for Monday, etc.) and <hour> represents the hour in 24 hour format (0 for midnight, 6 for 6am, 12 for noon, 18 for 6pm, etc.). An example of the key would be "DH:3:14" which represents Wednesday at 2pm. The value portion of the key value pair is customarily set to the boolean value true.
activeWindowTz String The timezone that the time portion of the activeWindow defines.
createdBy String  The creator of this trigger.
createdOn String The creation timestamp of this trigger.
updatedBy String The updater of this trigger.
updatedOn String The update timestamp of this trigger.

Action Object

Name Type Description
type String Action type.
params Array A set of named parameters for the action. This will vary by action.
canvas Array Canvas information where the action is placed.
routes Array Where the success and failure points go.

Action Canvas Object

Name Type Description
success String When successful, this defines the next node to execute.
failure String When there is a failure, this defines the next node to execute.
left String A numeric string indicating the left-offset where the action should appear on the canvas.
top String A numeric string indicating the top-offset where the action should appear on the canvas.

Action Routes Object

Name Type Description
success String When successful, this defines the next node to execute.
failure String When there is a failure, this defines the next node to execute.