How to Create a Middleware Server to Manage Data Between Two Apps and Trigger Actions Based on the Path in Pipedream Webhook?

This topic was automatically generated from Slack. You can find the original thread here.

Hey I need to create a middleware server to manage data between two apps.

So when i recieve a request on pipedream webhook , how do i trigger actions based on the path such as ‘/enroll’ | ‘/create’ ?

Hi, I think your question is a great case for Pipedream bot to help. I’ll pass your question to the Pipedream bot now. Please feel free to ask it any question

Hey I need to create a middleware server to manage data between two apps.

So when i recieve a request on pipedream webhook , how do i trigger actions based on the path such as ‘/enroll’ | ‘/create’ ?

To achieve this in Pipedream, you can create an HTTP trigger and then use a code step to handle different paths like /enroll and /create. Here’s an example of how you can set this up: 1. Create a new workflow with an HTTP trigger. 2. Add a code step after the HTTP trigger and use the following code: export default defineComponent({ async run({ steps, $ }) { const path = steps.trigger.event.path; if (path === "/enroll") { // Handle the enroll action here } else if (path === "/create") { // Handle the create action here } else { // Handle other paths or return an error } }, }); In this example, the path variable will contain the path of the incoming HTTP request. Based on the path, you can add your logic for the /enroll and /create actions within the respective if-else blocks.

I’ll use a source instead and direct the path to WF based on the URL

Understood thanks