You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/apps/components/custom-journey-block.md
+64Lines changed: 64 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -151,6 +151,70 @@ Once your App with a custom Journey Block is installed, you can use it in the Jo
151
151
152
152
153
153
154
+
## Calling External APIs via Proxy
155
+
156
+
Custom journey blocks run in the browser. If your block needs to call a third-party API that requires credentials (API keys, OAuth tokens, etc.), **never embed those secrets in your client-side code**. Instead, use the [API Proxy](./api-proxy.md) — it runs server-side and injects credentials on your behalf so they never reach the browser.
157
+
158
+
### Setup
159
+
160
+
1.**Add an API Proxy component** to your app in the App Builder (see [API Proxy docs](./api-proxy.md) for full setup).
161
+
2.**Install the App SDK** in your journey block project:
162
+
163
+
```bash
164
+
npm install @epilot/app-sdk
165
+
```
166
+
167
+
### Using the proxy in a journey block
168
+
169
+
Journey blocks receive a `publicToken` via the container props. Pass this token to the `proxy` function to authenticate the request:
|`body`| Optional request body (automatically serialized to JSON) |
201
+
202
+
:::tip
203
+
The `publicToken` is only available at runtime when the journey is rendered for an end user. During development, you can test with a hardcoded token — just make sure to remove it before publishing.
204
+
:::
205
+
206
+
### How it works
207
+
208
+
1. Your journey block calls `proxy()` with the `publicToken`
209
+
2. The request is sent to the epilot proxy server (not directly to the third-party API)
210
+
3. The proxy resolves the credentials configured in the App Builder (API key, Bearer token, or OAuth 2.0)
211
+
4. The proxy forwards the request to the target API with credentials injected server-side
212
+
5. The response is returned to your journey block
213
+
214
+
This means your API keys and secrets are **never exposed** in the journey's client-side bundle or network requests visible to end users.
215
+
216
+
For full details on authentication types, request signing, and security, see the [API Proxy documentation](./api-proxy.md).
0 commit comments