diff --git a/docs-v2/pages/code/nodejs/index.mdx b/docs-v2/pages/code/nodejs/index.mdx index ae72b0295fe4f..0138814665d64 100644 --- a/docs-v2/pages/code/nodejs/index.mdx +++ b/docs-v2/pages/code/nodejs/index.mdx @@ -352,6 +352,27 @@ In general, if you just need to make an HTTP request but don't care about the re You can return HTTP responses from [HTTP-triggered workflows](/workflows/steps/triggers/#http) using the [`$.respond()` function](/workflows/steps/triggers/#http-responses). +## Invoke another workflow + + +This is an alpha feature and is subject to change without prior notice. + + +You can invoke another workflow in your workspace with `$.flow.trigger`: + +``` +await $.flow.trigger( + workflowId, // your Pipedream workflow ID, e.g. p_abc123 + payload, // any JSON-serializable data +) +``` + +[Find your workflow's ID here.](/troubleshooting#where-do-i-find-my-workflows-id) + +This invokes the workflow directly -- you don't need to configure a trigger, and the request does not leave the platform. + +We also provide a [Trigger Workflow](https://pipedream.com/apps/helper-functions/actions/trigger-workflow) action in the [Helper Functions](https://pipedream.com/apps/helper-functions) app so you don't need to do it by code! + ## Ending a workflow early diff --git a/docs-v2/pages/troubleshooting.mdx b/docs-v2/pages/troubleshooting.mdx index 3b236f6913c73..08b5c5c8456ee 100644 --- a/docs-v2/pages/troubleshooting.mdx +++ b/docs-v2/pages/troubleshooting.mdx @@ -62,6 +62,12 @@ https://pipedream.com/@dylburger/p_abc123/edit Your workflow's ID is the value that starts with `p_`. In this example: `p_abc123`. +## How do I invoke another workflow? + +We provide a [Trigger Workflow](https://pipedream.com/apps/helper-functions/actions/trigger-workflow) action in the [Helper Functions](https://pipedream.com/apps/helper-functions) app. [See more here](/code/nodejs#invoke-another-workflow). + +Another option is to make an HTTP request to a Pipedream HTTP webhook trigger. + ## Where do I find my event source's ID? Open [https://pipedream.com/sources](https://pipedream.com/sources) and click on your event source. Copy the URL that appears in your browser's address bar. For example: