@@ -55,8 +55,8 @@ import { createBackendClient } from "@pipedream/sdk";
5555//  These secrets should be saved securely and passed to your environment
5656const =  createBackendClient ({
5757  credentials: {
58-     clientId: " your-oauth-client-id " 
59-     clientSecret: " your-oauth-client-secret " 
58+     clientId: " {oauth_client_id} " 
59+     clientSecret: " {oauth_client_secret} " 
6060  }
6161});
6262
@@ -123,62 +123,7 @@ If you need higher rate limits, please [reach out](https://pipedream.com/support
123123
124124### Invoke workflows  
125125
126- You can use the SDK to invoke workflows on behalf of any end user. ** Write one workflow, run it for all of your users** .
127- 
128- <Tabs  items = { [' TypeScript' ' Node.js' } >
129- <Tabs.Tab >
130- ``` typescript 
131- import  { createBackendClient , HTTPAuthType  } from  " @pipedream/sdk" 
132-  
133- //  These secrets should be saved securely and passed to your environment
134- const =  createBackendClient ({
135-   credentials: {
136-     clientId: " YOUR_CLIENT_ID" 
137-     clientSecret: " YOUR_CLIENT_SECRET" 
138-   },
139- });
140- 
141- await  pd .invokeWorkflowForExternalUser (
142-   " enabc123" //  pass the endpoint ID or full URL here
143-   " external_user_id" //  The end user's ID in your system
144-   {
145-     method: " POST" 
146-     body: {
147-       key: " value" 
148-     }
149-   },
150-   HTTPAuthType .OAuth  //  Will automatically send the Authorization header with a fresh token
151- )
152- ``` 
153- </Tabs.Tab >
154- <Tabs.Tab >
155- ``` javascript 
156- import  { createBackendClient  } from  " @pipedream/sdk" 
157- 
158- //  These secrets should be saved securely and passed to your environment
159- const  pd  =  createBackendClient ({
160-   credentials:  {
161-     clientId:  " YOUR_CLIENT_ID" 
162-     clientSecret:  " YOUR_CLIENT_SECRET" 
163-   },
164- });
165- 
166- await  pd .invokeWorkflowForExternalUser (
167-   " enabc123" //  pass the endpoint ID or full URL here
168-   " external_user_id" //  The end user's ID in your system
169-   {
170-     method:  " POST" 
171-     body:  {
172-       key:  " value" 
173-     }
174-   },
175-   " oauth" //  Will automatically send the Authorization header with a fresh token
176- )
177- ``` 
178- </Tabs.Tab >
179- </Tabs >
180- 
181- See the [ workflow invocation docs] ( /workflows/triggers#oauth )  for more details.
126+ You can use the SDK to [ invoke workflows on behalf of any end user] ( /connect/workflows ) . ** Write one workflow, run it for all of your users** .
182127
183128### Tokens  
184129
@@ -245,15 +190,17 @@ import {
245190} from  " @pipedream/sdk" 
246191
247192const =  createBackendClient ({
193+   environment: " development" //  change to production if running for a test production account, or in production
248194  credentials: {
249-     clientId: " your-oauth-client-id" 
250-     clientSecret: " your-oauth-client-secret" 
251-   }
195+     clientId: " {oauth_client_id}" 
196+     clientSecret: " {oauth_client_secret}" 
197+   },
198+   projectId: " {your_project_id}" 
252199});
253200
254201const =  await  pd .createConnectToken ({
255-   project_id: " your-project-id " 
256-   external_user_id: " your-external-user-id " //  The end user's ID in your system
202+   project_id: " {your_project_id} " 
203+   external_user_id: " {your_external_user_id} " //  The end user's ID in your system
257204});
258205``` 
259206</Tabs.Tab >
@@ -262,15 +209,17 @@ const { token, expires_at } = await pd.createConnectToken({
262209import  { createBackendClient  } from  " @pipedream/sdk" 
263210
264211const  pd  =  createBackendClient ({
212+   environment:  " development" //  change to production if running for a test production account, or in production
265213  credentials:  {
266-     clientId:  " your-oauth-client-id " 
267-     clientSecret:  " your-oauth-client-secret " 
214+     clientId:  " {oauth_client_id} " 
215+     clientSecret:  " {oauth_client_secret} " 
268216  },
217+   projectId:  " {your_project_id}" 
269218});
270219
271220const  { token , expires_at  } =  await  pd .createConnectToken ({
272-   project_id:  " your-project-id " 
273-   external_user_id:  " your-external-user-id " //  The end user's ID in your system
221+   project_id:  " {your_project_id} " 
222+   external_user_id:  " {your_external_user_id} " //  The end user's ID in your system
274223});
275224``` 
276225</Tabs.Tab >
@@ -291,7 +240,7 @@ curl -X POST https://api.pipedream.com/v1/connect/{project_id}/tokens \
291240  -H " Content-Type: application/json" 
292241  -H " Authorization: Bearer {access_token}" 
293242  -d ' {
294-     "external_user_id": "your-external-user-id " 
243+     "external_user_id": "{your_external_user_id} " 
295244  }'  
296245``` 
297246</Tabs.Tab >
@@ -349,10 +298,12 @@ import {
349298} from  " @pipedream/sdk" 
350299
351300const =  createBackendClient ({
301+   environment: " development" //  change to production if running for a test production account, or in production
352302  credentials: {
353-     clientId: " your-oauth-client-id" 
354-     clientSecret: " your-oauth-client-secret" 
355-   }
303+     clientId: " {oauth_client_id}" 
304+     clientSecret: " {oauth_client_secret}" 
305+   },
306+   projectId: " {your_project_id}" 
356307});
357308
358309const =  await  pd .getAccounts ({
@@ -368,10 +319,12 @@ const accounts = await pd.getAccounts({
368319import  { createBackendClient  } from  " @pipedream/sdk" 
369320
370321const  pd  =  createBackendClient ({
322+   environment:  " development" //  change to production if running for a test production account, or in production
371323  credentials:  {
372-     clientId:  " your-oauth-client-id" 
373-     clientSecret:  " your-oauth-client-secret" 
374-   }
324+     clientId:  " {oauth_client_id}" 
325+     clientSecret:  " {oauth_client_secret}" 
326+   },
327+   projectId:  " {your_project_id}" 
375328});
376329
377330const  accounts  =  await  pd .getAccounts ({
@@ -513,10 +466,12 @@ import {
513466} from  " @pipedream/sdk" 
514467
515468const =  createBackendClient ({
469+   environment: " development" //  change to production if running for a test production account, or in production
516470  credentials: {
517-     clientId: " your-oauth-client-id" 
518-     clientSecret: " your-oauth-client-secret" 
519-   }
471+     clientId: " {oauth_client_id}" 
472+     clientSecret: " {oauth_client_secret}" 
473+   },
474+   projectId: " {your_project_id}" 
520475});
521476
522477const =  await  pd .getAccount (accountId , {
@@ -532,10 +487,12 @@ const account = await pd.getAccount(accountId, {
532487import  { createBackendClient  } from  " @pipedream/sdk" 
533488
534489const  pd  =  createBackendClient ({
490+   environment:  " development" //  change to production if running for a test production account, or in production
535491  credentials:  {
536-     clientId:  " your-oauth-client-id" 
537-     clientSecret:  " your-oauth-client-secret" 
538-   }
492+     clientId:  " {oauth_client_id}" 
493+     clientSecret:  " {oauth_client_secret}" 
494+   },
495+   projectId:  " {your_project_id}" 
539496});
540497
541498const  accountId  =  " {account_id}" //  Replace with your account ID
@@ -653,10 +610,12 @@ import {
653610} from  " @pipedream/sdk" 
654611
655612const =  createBackendClient ({
613+   environment: " development" //  change to production if running for a test production account, or in production
656614  credentials: {
657-     clientId: " your-oauth-client-id" 
658-     clientSecret: " your-oauth-client-secret" 
659-   }
615+     clientId: " {oauth_client_id}" 
616+     clientSecret: " {oauth_client_secret}" 
617+   },
618+   projectId: " {your_project_id}" 
660619});
661620
662621await  pd .deleteAccount (accountId );
@@ -669,10 +628,12 @@ await pd.deleteAccount(accountId);
669628import  { createBackendClient  } from  " @pipedream/sdk" 
670629
671630const  pd  =  createBackendClient ({
631+   environment:  " development" //  change to production if running for a test production account, or in production
672632  credentials:  {
673-     clientId:  " your-oauth-client-id" 
674-     clientSecret:  " your-oauth-client-secret" 
675-   }
633+     clientId:  " {oauth_client_id}" 
634+     clientSecret:  " {oauth_client_secret}" 
635+   },
636+   projectId:  " {your_project_id}" 
676637});
677638
678639await  pd .deleteAccount (accountId);
@@ -733,10 +694,12 @@ import {
733694} from  " @pipedream/sdk" 
734695
735696const =  createBackendClient ({
697+   environment: " development" //  change to production if running for a test production account, or in production
736698  credentials: {
737-     clientId: " your-oauth-client-id" 
738-     clientSecret: " your-oauth-client-secret" 
739-   }
699+     clientId: " {oauth_client_id}" 
700+     clientSecret: " {oauth_client_secret}" 
701+   },
702+   projectId: " {your_project_id}" 
740703});
741704
742705await  pd .deleteAccountsByApp (appId );
@@ -749,10 +712,12 @@ await pd.deleteAccountsByApp(appId);
749712import  { createBackendClient  } from  " @pipedream/sdk" 
750713
751714const  pd  =  createBackendClient ({
715+   environment:  " development" //  change to production if running for a test production account, or in production
752716  credentials:  {
753-     clientId:  " your-oauth-client-id" 
754-     clientSecret:  " your-oauth-client-secret" 
755-   }
717+     clientId:  " {oauth_client_id}" 
718+     clientSecret:  " {oauth_client_secret}" 
719+   },
720+   projectId:  " {your_project_id}" 
756721});
757722
758723await  pd .deleteAccount (accountId);
@@ -813,10 +778,12 @@ import {
813778} from  " @pipedream/sdk" 
814779
815780const =  createBackendClient ({
781+   environment: " development" //  change to production if running for a test production account, or in production
816782  credentials: {
817-     clientId: " your-oauth-client-id" 
818-     clientSecret: " your-oauth-client-secret" 
819-   }
783+     clientId: " {oauth_client_id}" 
784+     clientSecret: " {oauth_client_secret}" 
785+   },
786+   projectId: " {your_project_id}" 
820787});
821788
822789await  pd .deleteExternalUser (externalId );
@@ -829,10 +796,12 @@ console.log("All accounts associated with the external ID have been deleted.");
829796import  { createBackendClient  } from  " @pipedream/sdk" 
830797
831798const  pd  =  createBackendClient ({
799+   environment:  " development" //  change to production if running for a test production account, or in production
832800  credentials:  {
833-     clientId:  " your-oauth-client-id" 
834-     clientSecret:  " your-oauth-client-secret" 
835-   }
801+     clientId:  " {oauth_client_id}" 
802+     clientSecret:  " {oauth_client_secret}" 
803+   },
804+   projectId:  " {your_project_id}" 
836805});
837806
838807const  externalId  =  " {external_user_id}" //  Replace with your external user ID
@@ -889,14 +858,16 @@ GET /{project_id}/info
889858import  { createBackendClient  } from  " @pipedream/sdk" 
890859
891860const =  createBackendClient ({
861+   environment: " development" //  change to production if running for a test production account, or in production
892862  credentials: {
893-     clientId: " your-oauth-client-id" 
894-     clientSecret: " your-oauth-client-secret" 
895-   }
863+     clientId: " {oauth_client_id}" 
864+     clientSecret: " {oauth_client_secret}" 
865+   },
866+   projectId: " {your_project_id}" 
896867});
897868
898869const =  await  pd .getProjectInfo ({
899-   project_id: " your-project-id " 
870+   project_id: " {your_project_id} " 
900871});
901872``` 
902873</Tabs.Tab >
@@ -905,14 +876,16 @@ const info = await pd.getProjectInfo({
905876import  { createBackendClient  } from  " @pipedream/sdk" 
906877
907878const  pd  =  createBackendClient ({
879+   environment:  " development" //  change to production if running for a test production account, or in production
908880  credentials:  {
909-     clientId:  " your-oauth-client-id" 
910-     clientSecret:  " your-oauth-client-secret" 
911-   }
881+     clientId:  " {oauth_client_id}" 
882+     clientSecret:  " {oauth_client_secret}" 
883+   },
884+   projectId:  " {your_project_id}" 
912885});
913886
914887const  info  =  await  pd .getProjectInfo ({
915-   project_id:  " your-project-id " 
888+   project_id:  " {your_project_id} " 
916889});
917890``` 
918891</Tabs.Tab >
0 commit comments