Core

Triggers

Triggers allow you to set up real time integrations with hundreds of underlying services (Ex. Salesforce, Slack, Jira etc.).

The job of setting webhooks, subscripting to events from a 3rd party system can be made hassle free by using the vast library of Tray Triggers.

Here is how you can implement a basic use case of notifying Sales channel in Slack for new / updated leads in Salesforce:

  1. Use the Salesforce trigger to listen for any new/updated lead
  2. Grab the lead data using find_record operation of Salesforce connector
  3. Format data to be sent to Slack
  4. Send a Slack notification using send_message operation of Slack connector

List Subscriptions

This endpoint is non-billable.

Returns a paginated list of susbcriptions.

You can use the pageInfo parameters to traverse through pages and collect response.

If hasNextPage is true then pass the endCursor to query parameter after to obtain the next page of response.

Create Subscription

Delivery of event payloads after a subscription is created are billable.

Every event payload that is processed (see note below) by Tray is billed as 1 task.

Note: Processed events include:

  1. Events that were delivered to your subscription URL successfully
  2. Events where Tray attempted delivery but your endpoint doesn't respond after retries
  3. Events which you filter out at the connector level e.g. applying a filter condition using pick val on salesforce 'on record create'.

Since all of the above events were processed by Tray, these will be billed.

Creates a subscription using a trigger operation and returns the state of subscription.

The input is a regular json object that must fit the input schema of the operation as retrieved from Get trigger operations.

The authId field should be the id of a previously created authentication.

The output is also a regular json object containing the response from the 3rd party. The state field indicates the current status of the subscription.

This reqest has a 60 seconds timeout, if the subscription is created successfully within 60 seconds, you will receive a response with active state.

Event payload

Once a subscription is in active state, the events would start coming at the endpoint defined the request.

Here is how the event payload may look like:

{
    "id": "<uuid>",
    "subscription": {
        "id": "<uuid>",
        "externalId": "<external_id>"
    },
    "outcome": "success",
    "body": {},
    "timestamp": "2023-04-13 10:04:00Z"
}

If the outcome is success, the body in the above payload would follow the Output Schema of the trigger operation.

You can visualize the sample event payloads from any Trigger in the Operations Explorer app.

If the outcome is failure, then manual testing with the API is required as every 3rd party service would have it's own failure responses.

Get Subscription

This endpoint is non-billable.

Returns a single subscription object using subscription ID as the parameter.

Delete Subscription

This endpoint is non-billable.

Deletes a subscription using subscription ID as the parameter.

List Triggers

This endpoint is non-billable.

Returns a list with all the available triggers from Tray's trigger library. A trigger can have multiple versions.

The following key data is returned:

List Trigger Operations

This endpoint is non-billable.

Returns a list with all the available operations for a given trigger

Each trigger operation has an input schema that can be used by a frontend to build a form or validate data.

You can then use the input schema to construct your inputs for the 'Create subscription' operation.

Was this page helpful?