Skip to content

Commit bd467d7

Browse files
connect object in apps API
1 parent 3d4d24e commit bd467d7

File tree

4 files changed

+144
-20
lines changed

4 files changed

+144
-20
lines changed

docs-v2/pages/connect/api-proxy.mdx

Lines changed: 108 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Tabs } from 'nextra/components'
12
import Callout from '@/components/Callout'
23

34
# Connect API Proxy
@@ -24,8 +25,9 @@ Before getting started with the Connect proxy, make sure you've already gone thr
2425

2526
## Getting started
2627

27-
You can send requests to the Connect proxy using the [Pipedream SDK](#using-the-pipedream-sdk) with a fetch-style interface, or directly to the [Pipedream REST API](#using-the-rest-api).
28+
You can send requests to the Connect proxy using the Pipedream SDK with a fetch-style interface, or directly to the Pipedream REST API.
2829

30+
**Prerequisites:**
2931
- A [Pipedream OAuth client](/rest-api/auth/#oauth) to make authenticated requests to Pipedream's API
3032
- Connect [environment](/connect/managed-auth/environments/) (ex, `production` or `development`)
3133
- The [external user ID](/connect/api/#external-users) for your end user (ex, `abc-123`)
@@ -41,14 +43,17 @@ Since Pipedream has {process.env.PUBLIC_APPS}+ integrated apps, we know how the
4143

4244
### Sending requests
4345

46+
When making requests through the Connect proxy, you'll need to provide the following:
47+
48+
#### Request parameters
49+
4450
**URL**
4551

4652
- The URL of the API you want to call (ex, `https://slack.com/api/chat.postMessage`)
4753
- When using the REST API, this should be a URL-safe Base64 encoded string (ex, `aHR0cHM6Ly9zbGFjay5jb20vYXBpL2NoYXQucG9zdE1lc3NhZ2U`)
4854

4955
<Callout type="info">
50-
- Some APIs like Zendesk, Zoho, and others use dynamic base domains that are account-specific (e.g, `https://foo.zendesk.com`). For any of these apps, you should pass a relative path as the `url` in your proxy request, like `/api/v2/chat/chats` for example.
51-
- Those dynamic fields are typically defined by the end user during the account connection flow, so the domain value will be stored as part of their connected account credentials in Pipedream.
56+
**For apps with dynamic domains** (like Zendesk, Zoho, GitLab), you should use relative paths in your proxy requests. Pipedream automatically resolves the correct domain based on the user's connected account. See [When to use relative vs full URLs](#when-to-use-relative-vs-full-urls) for details.
5257
</Callout>
5358

5459
**HTTP method**
@@ -64,10 +69,10 @@ Since Pipedream has {process.env.PUBLIC_APPS}+ integrated apps, we know how the
6469
- If using the REST API, include the `Authorization` header with your Pipedream OAuth access token (`Bearer {access_token}`)
6570
- Headers that contain the prefix `x-pd-proxy` will get forwarded to the upstream API
6671

67-
#### Using the Pipedream SDK
68-
69-
You can use the [Pipedream SDK](https://www.npmjs.com/package/@pipedream/sdk) to send a fetch-style request:
72+
#### Examples
7073

74+
<Tabs items={['Node.js', 'cURL']}>
75+
<Tabs.Tab>
7176
```javascript
7277
import { createBackendClient } from "@pipedream/sdk/server";
7378

@@ -106,11 +111,8 @@ const resp = await pd.makeProxyRequest(
106111
// Parse and return the data you need
107112
console.log(resp);
108113
```
109-
110-
#### Using the REST API
111-
112-
You can also use the Connect REST API directly. If using the REST API, send your Pipedream OAuth access token in the `Authorization` header:
113-
114+
</Tabs.Tab>
115+
<Tabs.Tab>
114116
```bash
115117
# First, obtain an OAuth access token to authenticate to the Pipedream API
116118

@@ -134,10 +136,104 @@ curl -X POST "https://api.pipedream.com/v1/connect/{your_project_id}/proxy/{url_
134136

135137
# Parse and return the data you need
136138
```
139+
</Tabs.Tab>
140+
</Tabs>
141+
142+
## Allowed domains
143+
144+
The vast majority of apps in Pipedream work with the Connect Proxy. To check if an app is supported and what domains are allowed, use `pd.getApps()` or the [`/apps` REST API](/rest-api/#list-apps).
145+
146+
### Understanding the Connect object
147+
148+
Each app in the `/apps` API response includes a `connect` object:
149+
150+
```json
151+
{
152+
"id": "app_1Z2hw1",
153+
"name_slug": "gitlab",
154+
"name": "GitLab",
155+
// ...other fields...
156+
"connect": {
157+
"proxy_enabled": true,
158+
"allowed_domains": ["gitlab.com"],
159+
"base_proxy_target_url": "https://{{custom_fields.base_api_url}}"
160+
}
161+
}
162+
```
163+
164+
| Field | Description |
165+
|-------|--------------|
166+
| `proxy_enabled` | Whether the app supports the Connect Proxy |
167+
| `allowed_domains` | Domains you can send requests to when using full URLs |
168+
| `base_proxy_target_url` | The base URL for proxy requests, may contain placeholders for account-specific values |
169+
170+
### When to use relative vs full URLs
171+
172+
The format of `base_proxy_target_url` determines whether you should use a relative path or full URL:
173+
174+
#### Apps with static domains
175+
176+
If `base_proxy_target_url` is a standard URL (e.g., `https://slack.com`), you can use either:
177+
- **Full URL**: `https://slack.com/api/chat.postMessage`
178+
- **Relative path**: `/api/chat.postMessage`
179+
180+
#### Apps with dynamic domains
181+
182+
If `base_proxy_target_url` contains placeholders like `{{custom_fields.base_api_url}}`, you **must** use relative paths. This applies to:
183+
- Self-hosted instances (GitLab)
184+
- Apps with account-specific subdomains (Zendesk, Zoho)
185+
186+
For these apps, Pipedream resolves the actual domain from the user's connected account at runtime.
187+
188+
### Examples
189+
190+
<Tabs items={['Slack (static domain)', 'GitLab (dynamic domain)']}>
191+
<Tabs.Tab>
192+
```javascript
193+
// Both work
194+
await pd.makeProxyRequest({...}, {
195+
url: "https://slack.com/api/chat.postMessage"
196+
})
197+
198+
await pd.makeProxyRequest({...}, {
199+
url: "/api/chat.postMessage"
200+
})
201+
```
202+
</Tabs.Tab>
203+
<Tabs.Tab>
204+
```javascript
205+
// Must use relative path
206+
await pd.makeProxyRequest({...}, {
207+
url: "/api/v4/projects" // Pipedream resolves to the end user's GitLab instance
208+
})
209+
```
210+
</Tabs.Tab>
211+
</Tabs>
212+
213+
### Discovering app support programmatically
214+
215+
<Tabs items={['SDK', 'REST API']}>
216+
<Tabs.Tab>
217+
```javascript
218+
const apps = await pd.getApps()
219+
220+
// Filter for apps that support the proxy
221+
const proxyEnabledApps = apps.filter(app => app.connect?.proxy_enabled)
222+
```
223+
</Tabs.Tab>
224+
<Tabs.Tab>
225+
```bash
226+
curl https://api.pipedream.com/v1/apps \
227+
-H "Authorization: Bearer <token>"
228+
```
229+
230+
Filter the response for apps where `connect.proxy_enabled` is `true`.
231+
</Tabs.Tab>
232+
</Tabs>
137233
138234
## Limits
139235
140236
The Connect proxy limits API requests to,
141-
- 100 requests per minute per project. Requests that surpass this limit will receive a `429` response.
237+
- 1,000 requests per 5 minutes per project. Requests that surpass this limit will receive a `429` response.
142238
- A maximum timeout of 30 seconds. Requests that take longer than 30 seconds will be terminated, and Pipedream will return a `504` error to the caller.
143239
- Please [let us know](https://pipedream.com/support) if you need higher limits.

docs-v2/pages/connect/components/index.mdx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,12 @@ Here's the response:
123123
"categories": [
124124
"Developer Tools"
125125
],
126-
"featured_weight": 5000
126+
"featured_weight": 5000,
127+
"connect": {
128+
"proxy_enabled": true,
129+
"allowed_domains": ["gitlab.com"],
130+
"base_proxy_target_url": "https://{{custom_fields.base_api_url}}"
131+
}
127132
}
128133
]
129134
}

docs-v2/pages/rest-api/index.mdx

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,12 @@ curl https://api.pipedream.com/v1/apps
391391
"categories": [
392392
"Communication"
393393
],
394-
"featured_weight": 1000000001
394+
"featured_weight": 1000000001,
395+
"connect": {
396+
"proxy_enabled": true,
397+
"allowed_domains": ["slack.com"],
398+
"base_proxy_target_url": "https://slack.com"
399+
}
395400
},
396401
{
397402
"id": "app_mWnheL",
@@ -404,7 +409,12 @@ curl https://api.pipedream.com/v1/apps
404409
"categories": [
405410
"Communication"
406411
],
407-
"featured_weight": 4100
412+
"featured_weight": 4100,
413+
"connect": {
414+
"proxy_enabled": true,
415+
"allowed_domains": ["slack.com"],
416+
"base_proxy_target_url": "https://slack.com"
417+
}
408418
}
409419
]
410420
}
@@ -443,8 +453,8 @@ curl https://api.pipedream.com/v1/apps/app_OkrhR1 \
443453
#### Example Response
444454

445455
```json
446-
"data": [
447-
{
456+
{
457+
"data": {
448458
"id": "app_OkrhR1",
449459
"name_slug": "slack",
450460
"name": "Slack",
@@ -454,10 +464,15 @@ curl https://api.pipedream.com/v1/apps/app_OkrhR1 \
454464
"custom_fields_json": "[]",
455465
"categories": [
456466
"Communication"
457-
]
458-
"featured_weight": 1000000001
467+
],
468+
"featured_weight": 1000000001,
469+
"connect": {
470+
"proxy_enabled": true,
471+
"allowed_domains": ["slack.com"],
472+
"base_proxy_target_url": "https://slack.com"
473+
}
459474
}
460-
]
475+
}
461476
```
462477

463478
## Components

pnpm-lock.yaml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)