ApplicationExperience

Experience Endpoint Trigger Node

The Endpoint Trigger will fire a workflow when the selected Experience Endpoint receives an HTTP request. It can be used in both Application Workflows and Experience Workflows, although the configuration differs slightly between the two.

Endpoint Trigger

Node Properties

The configuration for the Endpoint Trigger varies slightly depending on the type of workflow in which the trigger is used.

Experience Workflows

In Experience Workflows, just choose an endpoint that has been set up for the application as described in the endpoint documentation.

In the above example, the workflow will be triggered whenever the “POST /login” endpoint receives a request.

The Endpoint Trigger will only fire on a request to an endpoint in the same Experience Version as the workflow. This means that a request to your ‘develop’ domain’s POST /login endpoint will only fire the develop version of the workflow, not an experience version that also contains a POST /login endpoint and a workflow version containing this trigger.

Application Workflows

The configuration for the Endpoint Trigger for Application Workflows is slightly more complicated. Because Application Workflows are not versioned with your experience, you will need to select the version of your experience you want to use. By default this is the develop version:

Endpoint Trigger Config Application Workflow

Payload

The payload for a workflow triggered by an endpoint will include all of the information about the triggering request in the data field. This includes the request path, the request method, any request headers, any request query parameters, any parsed path parameters (based off the route definition for the endpoint), any cookies, and the request body. If there is no body present, the value for the body field will be null. Otherwise, if the content type is multipart/form-data, application/x-www-form-urlencoded, or application/json and the request body is valid for that content type, it will automatically be parsed into an object. For other content types, such as text/plain, the body will be left as a string.

The payload also contains an experience field, which contains four properties:

  • endpoint: Always the Experience Endpoint that received the request.
  • user: Either the Experience User making the request or null if it was a public unauthenticated request.
  • version: Contains the name of the Experience Version for the request.
  • authInfo: Contains data about the token. If the endpoint did not receive a token this field will be null. The authInfo field contains three fields:

In the general case, an Endpoint Trigger workflow payload will look like the following:

{
  "applicationId": "555555555555eeeeeeeeeeee",
  "applicationName": "My Great Application",
  "data": {
    "body": {
      "age": "42",
      "name": "Jane"
    },
    "cookies": {},
    "headers": {
      "accept": "*/*",
      "content-length": "237",
      "content-type": "multipart/form-data",
      "user-agent": "curl/7.77.0",
      "x-forwarded-for": "<source IP address>",
      "x-forwarded-proto": "https",
      "x-real-ip": "<source IP address>"
    },
    "method": "get",
    "path": "/transition/up",
    "params": {
      "deviceId": "624335dd83a187df4e03c95e"
    },
    "query": {
      "location": "52"
    },
    "replyId": "<ID of Endpoint>.<Unique request ID>"
  },
  "experience": {
    "authInfo": {
      "issuedAt": "<if a token was given this is the generation date>",
      "expiresAt": "<if a token was given this is the expiration date>",
      "extraData": "<if a token was given this is the extra data on the token>"
    },
    "endpoint": {
      "access": "public",
      "applicationId": "<application ID>",
      "createdById": "<ID of resource that created the endpoint>",
      "createdByType": "user",
      "creationDate": Fri Feb 19 2016 17:26:00 GMT-0500 (EST),
      "enabled": true,
      "endpointTags": "<object of endpoint tags>",
      "experienceEndpointId": "<ID of the endpoint>",
      "experienceGroups": "<array of groups who have access to this endpoint>",
      "id": "<ID of the endpoint trigger>",
      "lastUpdated": Fri Feb 19 2016 17:26:00 GMT-0500 (EST),
      "lastUpdatedById": "<ID of resource that last updated this endpoint>",
      "lastUpdatedByType": "user",
      "method": "get",
      "route": "/transition/up",
      "version": "develop"
    },
    "user": {
      "applicationId": "<ID of the application>",
      "avatarUrl": null,
      "creationDate": Fri Feb 19 2016 17:26:00 GMT-0500 (EST),
      "email": "kanarra@example.com",
      "experienceGroups": [
        {
          "id": "<ID of the Experience Group>",
          "name": "<Name of the Experience Group>",
          "parentId": "<ID of the parent group, null if there is no parent>"
        }
      ],
      "experienceUserId": "<ID of the Experience User>",
      "id": "<ID of the Experience User>",
      "lastLogin": Fri Feb 19 2016 17:26:00 GMT-0500 (EST),
      "lastUpdated": Fri Feb 19 2016 17:26:00 GMT-0500 (EST),
      "passwordLastUpdated": Fri Feb 19 2016 17:26:00 GMT-0500 (EST),
      "userTags": {
        "adminRights": true
      }
    },
    "version": "<the experience version for the request>"
  },
  "flowId": "333333333333cccccccccccc",
  "flowName": "My Great Workflow",
  "flowVersion": "myFlowVersion",
  "globals": {
    "aJsonGlobal": {
      "key": "value"
    },
    "aNumberGlobal": 42,
    "aStringGlobal": "My value"
  },
  "relayId": "000000000000000000000000",
  "relayType": "public",
  "time": Fri Feb 19 2016 17:26:00 GMT-0500 (EST),
  "triggerId": "<ID of endpoint>",
  "triggerType": "endpoint"
}

Was this page helpful?


Still looking for help? You can also search the Losant Forums or submit your question there.