Connect API
Once your users have connected their third-party app accounts in the Connect Portal, you can access their app account via the Connect API.
The Connect API acts as a proxy to the third-party app provider's API, meaning that any of the third-party provider's API methods can be accessed directly via the Connect API. Call
.request
to send an API request to a third-party app on behalf of one of your users.Along with Workflows, the Connect API is one of two primary ways to build integrations with Paragon.
The Connect API is the most flexible way to interact with your users' third-party apps, and is a useful code-based approach for situations including:
- Performing a simple one-off request (e.g. fetching a list of Salesforce contacts)
- Writing custom code for complex or unique integration use cases
- Migrating existing integration code to Paragon
Every integration in your dashboard has a code example of using
paragon.request
, which takes three arguments:integrationType
: The short name for the integration. i.e. "salesforce" or "googleCalendar". You can find this string on the Overview tab of the integration you want to access, on your Paragon dashboard.path
: The path (without the hostname) of the API request you are trying to access. An example might be "/v1/charges" for Stripe's charge API or "chat.postMessage" for Slack's Web API.requestOptions
: Request options to include, such as:body
: An object representing JSON contents of the request.method
: An HTTP verb such as "GET" or "POST". Defaults to GET.
The function returns a promise for the request output, which will have a shape that varies depending on the integration and API endpoint.
JavaScript SDK
await paragon.request('slack', '/chat.postMessage', {
method: 'POST',
body: {
channel: 'CXXXXXXX0' // Channel ID,
text: 'This message was sent with Paragon Connect :exploding_head:'
}
});
// -> Responds with { ok: true }, and sends a message :)
If you'd like to issue a request from your server to an integration on behalf of an end-user, you can make a request to:
REST API
https://api.useparagon.com/projects/<Paragon Project ID>/sdk/proxy
/<Integration name>/<API path>
Authorization: Bearer <Paragon User Token>
- A Bearer token must also be specified with a Paragon User Token.
- This endpoint accepts any HTTP verb you want to use with the API.
- Body contents must be specified as
application/json
.
Example:
REST API
POST https://api.useparagon.com/projects/19d...012/sdk/proxy/slack/chat.postMessage
Authorization: Bearer eyJ...
Content-Type: application/json
{
"channel": "CXXXXXXX0",
"text": "This message was sent with Paragon Connect :exploding_head:"
}
Last modified 4mo ago