Skip to content

Commit d0032bd

Browse files
Info on testing workflows
1 parent 95975b4 commit d0032bd

File tree

1 file changed

+40
-15
lines changed

1 file changed

+40
-15
lines changed

docs-v2/pages/connect/workflows.mdx

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import { Steps, Tabs } from 'nextra/components'
2+
import ArcadeEmbed from '@/components/ArcadeEmbed'
3+
import Callout from '@/components/Callout'
4+
import Image from 'next/image'
25

36
# Running workflows for your end users
47

@@ -33,47 +36,69 @@ Read [the quickstart](/quickstart/) to learn more.
3336

3437
### Create an OAuth client
3538

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+
3741

3842
### Create a workflow
3943

4044
[Create a new workflow](/workflows#how-do-i-create-a-new-workflow) or open an existing one.
4145

4246
### Add an HTTP trigger, configure OAuth
4347

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.**
4650

4751
### Configure accounts to use your end users' auth
4852

4953
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:
5054

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.
5256

5357
<div className="my-4">
5458
<img width="300px" src="https://res.cloudinary.com/pipedreamin/image/upload/v1730936163/docs/Screenshot_2024-11-06_at_3.35.58_PM_a4evmq.png" />
5559
</div>
5660

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**:
5862

5963
<div className="my-4">
6064
<img width="300px" src="https://res.cloudinary.com/pipedreamin/image/upload/v1730936776/docs/Screenshot_2024-11-06_at_3.46.10_PM_mxjvla.png" />
6165
</div>
6266

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).
6668

6769
### Connect a test account
6870

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 />
7096

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} />
7298

73-
If you've don't have a test account, create one:
99+
### Deploy your workflow
74100

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.
77102

78103
### Invoke the workflow
79104

@@ -187,6 +212,6 @@ curl -X POST https://{your-endpoint-url} \
187212
- 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.
188213
- You can check which connected accounts are available for that user [in the UI](/connect#users) or [via the API](/connect/api#accounts).
189214

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.
192217
- Schedule a call with our sales team and learn more about pricing [here](https://pipedream.com/pricing?plan=Enterprise).

0 commit comments

Comments
 (0)