Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial commit of workflow SDK / OAuth docs #14053

Merged
merged 36 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
1c210e1
Initial commit of workflow invocation docs
dylburger Sep 21, 2024
97c5839
Merge remote-tracking branch 'origin/master' into connect/workflow-sd…
dylburger Sep 21, 2024
a9626a6
Merge remote-tracking branch 'origin/master' into connect/workflow-sd…
dylburger Sep 25, 2024
e06e919
removing old docs, adding IP clarification
dylburger Sep 25, 2024
bb5a9e2
Removing broken link checker
dylburger Sep 25, 2024
63ab997
Adding eslint-config-next to try to fix ESLint linting errors
dylburger Sep 25, 2024
cc1a987
Merge remote-tracking branch 'origin/master' into connect/workflow-sd…
dylburger Oct 16, 2024
8cfb804
Adding pnpm lock again
dylburger Oct 16, 2024
c087633
Work so far
dylburger Oct 17, 2024
72921fe
Many more fixes
dylburger Oct 18, 2024
b73b177
Many more docs changes
dylburger Oct 20, 2024
28417e6
Merge remote-tracking branch 'origin/master' into connect/workflow-sd…
dylburger Oct 20, 2024
9b798d5
Many more updates
dylburger Oct 22, 2024
f3bac44
Merge remote-tracking branch 'origin/master' into connect/workflow-sd…
dylburger Oct 22, 2024
b83ada2
Adding the PD SDK
dylburger Oct 24, 2024
cd7ce90
Updating Connect Link quickstart
dannyroosevelt Oct 24, 2024
86e7b51
Some more docs updates
dannyroosevelt Oct 24, 2024
bb694e8
Merge remote-tracking branch 'origin/master' into connect/workflow-sd…
dylburger Oct 28, 2024
3082b0c
Merge branch 'connect/workflow-sdk-docs' of github.com:PipedreamHQ/pi…
dylburger Oct 28, 2024
5d3206d
Adding Apps, Users, Webhooks docs
dylburger Oct 28, 2024
0a12942
Small tweaks
dannyroosevelt Oct 28, 2024
1e2ef10
Adding info re: OAuth clients to Connect docs
dannyroosevelt Oct 29, 2024
d5b256b
More info re: OAuth clients
dannyroosevelt Oct 30, 2024
4516cf0
Updating quickstart
dannyroosevelt Oct 30, 2024
7cfd4e9
Adding /apps APIs, new /accounts params, changing include_credentials…
dylburger Oct 31, 2024
3e2b4f5
Adding /components/search endpoint
dylburger Oct 31, 2024
f5d7c0c
Updating more client references
dylburger Nov 1, 2024
8f7acfe
getAccounts changes
dylburger Nov 1, 2024
0a5c3b6
Small quickstart fix
dylburger Nov 1, 2024
7cb7338
Merge remote-tracking branch 'origin/master' into connect/workflow-sd…
dylburger Nov 1, 2024
6bdfb2c
Docs tweaks
dannyroosevelt Nov 1, 2024
6e1d464
s/oauth app/oauth client
dannyroosevelt Nov 1, 2024
d5df964
Update quickstart.mdx
dannyroosevelt Nov 1, 2024
ce0bdeb
Adding migration guide
dylburger Nov 4, 2024
5c1160c
Merge remote-tracking branch 'origin/master' into connect/workflow-sd…
dylburger Nov 4, 2024
ea3f967
Merge remote-tracking branch 'origin/master' into connect/workflow-sd…
dylburger Nov 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 45 additions & 15 deletions docs-v2/pages/connect/api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,25 @@ or a specific version:

## Authentication

### OAuth

TO DO

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

OAuth section needs to be completed.

The OAuth section is currently marked as "TO DO". This important authentication method should be documented to provide a complete reference for users.

Please complete the OAuth section with relevant details and examples.

### Project keys

You authenticate to the Connect API using **Basic Auth**. Send your project public key as the username and the project secret key as the password. When you make API requests, pass an
`Authorization` header of the following format:

```shell
Authorization: Basic base_64(public_key:secret_key)
```

Clients like `cURL` will often make this easy. For example, here's how you list all accounts on a project:

```shell
curl 'https://api.pipedream.com/v1/connect/accounts' -u public_key:secret_key
```

### TypeScript SDK (Server)

Most of your interactions with the Connect API will happen on the server, to protect API requests and user credentials. You'll use the SDK in [your frontend](#typescript-sdk-browser) to let users connect accounts. Once connected, you'll use the SDK on the server to retrieve credentials, invoke workflows on their behalf, and more.
Expand Down Expand Up @@ -102,21 +121,6 @@ export default function Home() {
}
```

### REST API

You authenticate to the Connect API using **Basic Auth**. Send your project public key as the username and the project secret key as the password. When you make API requests, pass an
`Authorization` header of the following format:

```shell
Authorization: Basic base_64(public_key:secret_key)
```

Clients like `cURL` will often make this easy. For example, here's how you list all accounts on a project:

```shell
curl 'https://api.pipedream.com/v1/connect/accounts' -u public_key:secret_key
```

## External users

When you use the Connect API, you'll pass an `external_id` parameter when initiating account connections and retrieving credentials. This is your user's ID, in your system — whatever you use to uniquely identify them.
Expand All @@ -136,6 +140,32 @@ If you need higher rate limits, please [reach out](https://pipedream.com/support

## API Reference

### Invoke workflows

You can use the SDK to invoke workflows on behalf of your users. Here's an example of invoking a workflow with the SDK:

```typescript
import { createClient } from "@pipedream/sdk";

const pd = createClient({
oauthClientId: "your-oauth-client-id",
oauthClientSecret: "your-oauth-client-secret",
});

const response = await pd.invokeWorkflow(
"https://your-workflow-url.m.pipedream.net",
{
body: {
foo: 123,
bar: "abc",
},
// pass any other fetch options here
},
);
```

`invokeWorkflow` uses Node's `fetch` API, so you can pass any standard options in that object.

### Tokens

Your app will initiate the account connection flow for your end users in your frontend. But you can't expose your project keys in the client, since they'd be accessible to anyone. Instead, on your server, **you exchange your project keys for a short-lived token that allows a specific user to connect a specific app**, and return that token to your frontend.
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ class ServerClient {
* @example
* ```typescript
* const response: JSON = await client.invokeWorkflow(
* "https://eoy64t2rbte1u2p.m.pipedream.net",
* "https://en-your-endpoint.m.pipedream.net",
* {
* body: {
* foo: 123,
Expand Down
Loading