Endpoint Trigger
The Endpoint Trigger fires a workflow when the selected Experience Endpoint receives an HTTP request - or when any endpoint request is received at a domain tied to the selected Experience Version.
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, first choose the circumstances under which this trigger should fire. Two options are available …
Requests to a specific endpoint
For most uses of the trigger, this is the preferred option as it allows for processing data in expected formats and issuing replies to the requests. When selected, you must provide an Endpoint Method / Route, which is the Experience Endpoint whose received requests should fire the trigger.
The 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.
In the above example, the workflow will be triggered whenever the “POST /login” endpoint receives a request.
Requests to any endpoint in this version
This option is most useful for logging user activity in a third-party system such as Loggly or Google BigQuery. While it is possible to reply to requests when selecting this option, doing so is strongly discouraged as it likely introduces race conditions and undesired behavior for end users (as other Endpoint Triggers targeting the specific endpoint requested will still fire and may reply first).
Application Workflows
The configuration for the Endpoint Trigger for Application Workflows is slightly more complicated.
Requests to a specific endpoint
This option is similar to the “specific endpoint” option in Experience Workflows; however, you must also choose a specific Experience Version to go along with choosing one of the selected version’s Experience Endpoints. The default version is develop
.
Requests to any endpoint in a specific version
This option is similar to the “any endpoint in this version” option in Experience Workflows, except you must choose an Experience Version whose endpoint requests the trigger should target. The default is develop
.
Requests to any endpoint in any version
As the name implies, this option fires the trigger on requests to any endpoint in any version.
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 ornull
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. TheauthInfo
field contains three fields:issuedAt
: The time the token was issued.expiresAt
: The time the token will expire.extraData
Optional data added to the token by the Authenticate Node or the Generate Token Node.
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"
}
Notes on “Any Endpoint” Triggers
In addition to firing on endpoint requests that successfully resolve, triggers configured to fire on any endpoint request will also fire for the following scenarios:
- Requests that do not resolve against any configured endpoint (i.e. automatic
404 Not Found
responses). - Unauthorized requests (i.e. automatic
401 Unauthorized
and403 Forbidden
responses).
The trigger will not fire for the following scenarios:
- Automatic
429 Too Many Requests
responses. 400 Bad Request
responses - i.e. from requests over invalid protocols.413 Payload Too Large
responses.- Replies to
OPTIONS
requests when the experience version is configured to automatically handle CORS requests.
Related Nodes
Was this page helpful?
Still looking for help? You can also search the WEGnology Forums or submit your question there.