|
1 | 1 | import { Steps, Tabs } from 'nextra/components'
|
| 2 | +import ArcadeEmbed from '@/components/ArcadeEmbed' |
| 3 | +import Callout from '@/components/Callout' |
| 4 | +import Image from 'next/image' |
2 | 5 |
|
3 | 6 | # Running workflows for your end users
|
4 | 7 |
|
@@ -33,47 +36,69 @@ Read [the quickstart](/quickstart/) to learn more.
|
33 | 36 |
|
34 | 37 | ### Create an OAuth client
|
35 | 38 |
|
36 |
| -To run workflows for end users, you'll need to first [create a Pipedream OAuth client](/rest-api/auth#creating-an-oauth-client). Pipedream uses OAuth to authenticate requests to the Pipedream API and workflows. |
| 39 | +**This step is optional but strongly recommended.** To securely run workflows for end users, you'll need to first [create a Pipedream OAuth client](/rest-api/auth#creating-an-oauth-client). Pipedream uses OAuth to authenticate requests to the Pipedream API and workflows. |
| 40 | + |
37 | 41 |
|
38 | 42 | ### Create a workflow
|
39 | 43 |
|
40 | 44 | [Create a new workflow](/workflows#how-do-i-create-a-new-workflow) or open an existing one.
|
41 | 45 |
|
42 | 46 | ### Add an HTTP trigger, configure OAuth
|
43 | 47 |
|
44 |
| -1. Add an [HTTP trigger](/workflows/triggers#http) to your workflow |
45 |
| -2. [Configure **OAuth** authorization](/workflows/triggers#oauth) on the trigger |
| 48 | +1. Add an [HTTP trigger](/workflows/triggers#http) to your workflow. |
| 49 | +2. [Configure **OAuth** authorization](/workflows/triggers#oauth) on the trigger. Again, this step is optional **but strongly recommended.** |
46 | 50 |
|
47 | 51 | ### Configure accounts to use your end users' auth
|
48 | 52 |
|
49 | 53 | When you configure [pre-built actions](/workflows/actions) or [custom code that connects to third-party APIs](/code/nodejs/auth), you can link accounts in one of two ways:
|
50 | 54 |
|
51 |
| -1. **Use your own account**: If you're connecting to an API that uses your own app's API key or developer account — for example, a workflow that connects to the OpenAI API — click the **Connect an [app] account** button to link your own, static account. |
| 55 | +1. **Use your own account**: If you're connecting to an API that uses your own API key or developer account — for example, a workflow that connects to the OpenAI API or a PostgreSQL database — click the **Connect account** button to link your own, static account. |
52 | 56 |
|
53 | 57 | <div className="my-4">
|
54 | 58 | <img width="300px" src="https://res.cloudinary.com/pipedreamin/image/upload/v1730936163/docs/Screenshot_2024-11-06_at_3.35.58_PM_a4evmq.png" />
|
55 | 59 | </div>
|
56 | 60 |
|
57 |
| -2. **Use your end users' auth**: If you're building a workflow that connects to your end users' accounts — for example, a workflow that sends a message to a user's Slack account — you can select the option to **Use end user's auth via Connect**: |
| 61 | +2. **Use your end users' auth**: If you're building a workflow that connects to your end users' accounts — for example, a workflow that sends a message with your user's Slack account — you can select the option to **Use end user's auth via Connect**: |
58 | 62 |
|
59 | 63 | <div className="my-4">
|
60 | 64 | <img width="300px" src="https://res.cloudinary.com/pipedreamin/image/upload/v1730936776/docs/Screenshot_2024-11-06_at_3.46.10_PM_mxjvla.png" />
|
61 | 65 | </div>
|
62 | 66 |
|
63 |
| -This looks up the end user's account for this app, based on the user ID you provide [when invoking the workflow](#invoke-the-workflow). |
64 |
| - |
65 |
| -When you're done with the workflow, **Deploy** it. |
| 67 | +When you trigger the workflow, Pipedream will look up the corresponding account for the end user whose user ID you provide [when invoking the workflow](#invoke-the-workflow). |
66 | 68 |
|
67 | 69 | ### Connect a test account
|
68 | 70 |
|
69 |
| -You can connect a static account to the workflow step to test it, but to run an end-to-end test as an end user, you'll need to [invoke the workflow](#invoke-the-workflow) with a user ID that has linked a Connect account. |
| 71 | +To run an end-to-end test as an end user, you need to have users and connected accounts in your project. If you already have a **development** account linked, you can skip this step. |
| 72 | + |
| 73 | +If you don't, the fastest way to do this is [on the **Users** tab](/connect#users) in your Pipedream project: |
| 74 | +- You'll see there's a button to **Connect account** |
| 75 | +- Go through the flow and make sure to create the account in **development** mode |
| 76 | +- Note the **external user ID** of the account you just connected, you'll need it in the next step |
| 77 | + |
| 78 | +<ArcadeEmbed |
| 79 | + src="https://demo.arcade.software/5DwriJYz5lIIRlXkVZEK?embed" |
| 80 | + title="Pipedream Connect Test Account Flow"> |
| 81 | +</ArcadeEmbed> |
| 82 | + |
| 83 | +### Generate a test request |
| 84 | + |
| 85 | +Test events are critical for developing workflows effectively. Without a test event, you won't be able to test your workflow end to end in the builder, see the shape of the event data that triggers the workflow, and the lookup to use your end user's auth won't work. |
| 86 | + |
| 87 | +To generate a test event, click **Send Test Event** in the trigger, and fill in the event data. This will trigger the workflow and allow you to test the workflow end to end in the builder. |
| 88 | + |
| 89 | +<Callout type="info"> |
| 90 | +Make sure to include these headers in your test request: |
| 91 | +- `x-pd-environment: development` |
| 92 | +- `x-pd-external-user-id: {your_external_user_id}` |
| 93 | +</Callout> |
| 94 | + |
| 95 | +<br /> |
70 | 96 |
|
71 |
| -You'll see all accounts by end user ID in [the **Users** tab](/connect#users) of your Connect dashboard. If you already have a test account linked, get the external user ID and [invoke the workflow](#invoke-the-workflow). |
| 97 | +<Image src="https://res.cloudinary.com/pipedreamin/image/upload/v1732236408/connect-headers-test-request_vrnpmv.png" alt="Invoke workflow headers" width={800} height={529} /> |
72 | 98 |
|
73 |
| -If you've don't have a test account, create one: |
| 99 | +### Deploy your workflow |
74 | 100 |
|
75 |
| -- If you've already [added Connect to your app](/connect), run through your own app's integrations flow and link test accounts for the apps you're using. |
76 |
| -- You can also run [the Connect example app](/connect/quickstart) to quickly connect an account for any app. |
| 101 | +When you're done with the workflow, click **Deploy** at the top right. |
77 | 102 |
|
78 | 103 | ### Invoke the workflow
|
79 | 104 |
|
@@ -187,6 +212,6 @@ curl -X POST https://{your-endpoint-url} \
|
187 | 212 | - The external user ID was passed when invoking the workflow, but the user doesn't have a connected account for one or more of the apps that are configured to use it in this workflow execution.
|
188 | 213 | - You can check which connected accounts are available for that user [in the UI](/connect#users) or [via the API](/connect/api#accounts).
|
189 | 214 |
|
190 |
| -#### The Business plan is required to run this workflow for production users |
191 |
| -- Running workflows for your end users is available for users in `development`, but a Business plan is required to run on behalf of `production` users. |
| 215 | +#### Running workflows for your users in production requires a higher tier plan |
| 216 | +- Anyone is able to run workflows for your end users in `development`. The Business plan is required to run on behalf of `production` users. |
192 | 217 | - Schedule a call with our sales team and learn more about pricing [here](https://pipedream.com/pricing?plan=Enterprise).
|
0 commit comments