Using connectors and operations

Note on Billing
Copied!

API Endpoint Usage Billable
Get Connectors Returns a list with all the available connectors from Tray's connector library. No
Get Connector Operations Returns a list with all the available operations for a given connector No
Call Connector Executes an operation of a connector and returns the result as the response. Yes

Discovering connectors
Copied!

The Get Connectors (https://api.tray.io/core/v1/connectors) endpoint will return all of the connectors that you have access to:

The response includes:

  • connector name

  • connector version

These can then be used with the Get Connector Operations endpoint to list the available operations within a particular connector.

So if your organisation has access to Outreach and Twilio you would see the following:

📋
1
{
2
"elements": [
3
{
4
"name": "outreach",
5
"version": "3.2",
6
"title": "Outreach",
7
"description": ""
8
},
9
{
10
"name": "twilio-output",
11
"version": "2.1",
12
"title": "Twilio",
13
"description": "Cloud communication platform for developers"
14
}
15
]
16
}
17

Discovering operations
Copied!

The operations available within a connector can be identified using the Get Connector Operations endpoint.

So for Twilio the URL would be:

https://api.tray.io/core/v1/connectors/twilio-output/versions/2.1/operations

In the following sample response for Twilio, we have shown only the input schema for the 'Send SMS' operation.

Please see the Get Connector Operations endpoint for complete examples of operation lists and input and output schema:

📋
1
{
2
"elements": [
3
{
4
"name": "send_sms",
5
"title": "Send SMS",
6
"description": "Send SMS.",
7
"inputSchema": {
8
"$schema": "https://api.tray.io/core/v1/connectors/operations/input-schema#",
9
"advanced": [],
10
"additionalProperties": false,
11
"type": "object",
12
"properties": {
13
"body": {
14
"type": "string",
15
"description": "The body of the SMS to send.",
16
"title": "Body"
17
},
18
"media_url": {
19
"type": "string",
20
"title": "Media URL",
21
"description": "This parameter specifies the URL of the media you want to include with your message, for sending an MMS message."
22
},
23
"to": {
24
"type": "string",
25
"description": "The phone number (including international code) to send the sms to.",
26
"title": "To"
27
},
28
"from": {
29
"type": "string",
30
"description": "The valid Twilio number (or authorised number) from which the sms message will appear.",
31
"title": "From"
32
},
33
"status_callback": {
34
"type": "string",
35
"title": "Status callback URL",
36
"description": "By including a StatusCallback URL in your API call, you can tell Twilio where to POST information about your message."
37
}
38
},
39
"required": [
40
"to",
41
"from",
42
"body"
43
]
44
},
45
"hasDynamicOutput": false,
46
"authScopes": []
47
}
48
]
49
}
50

Using operations
Copied!

Connectors can be called using the Call Connector endpoint:

So to call the Twilio connector the following URL would be used:

https://api.tray.io/core/v1/connectors/twilio-output/versions/2.1/call

The body needs to contain:

  • The operation that is being called

  • The authId that was obtained earlier as part of the auth flow

  • The required inputs as dictated by the input schema

The following screenshot demonstrates how to use the above Twilio input schema to construct a call:

Please see the previous section for guidance on obtaining the required authId for the End User.

The response from call connector will be in accordance with the output schema obtained in the connector operations step.