How do I return a custom response in an HTTP-triggered workflow?

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

Synonymous : :wave: hello everyone. I am new to the platform and I’m trying to create my first project but having some trouble.

my workflow is the following:

Upon a GET HTTP request to Pipedream, I want Pipedream to fetch a row from my Google sheets, and then return it back as the response payload to the initial GET request.

To achieve this, I added a HTTP steps trigger, and then attached a send_http_request event, which makes a call to my Google sheets script.

I’m confused as to how I can now send this data from the send_http_request back to the initial GET request.

When I try it on curl, I just see the response as:

<p><b>Success!</b></p>
<p>To customize this response, check out our docs <a href="https://pipedream.com/docs/workflows/steps/triggers/#customizing-the-http-response">here</a></p>

Any ideas what I am doing wrong?

Michelle Bergeron : You’ll need to create a “custom response” that contains the data you get back from your Google Sheets script. Something like this:

const x = await (your call to the google sheets script)

$respond({
  status: 200,
  body: x
});

Pravin Savkar : Hi - here’s a simple workflow example you try out.

  1. Click “Copy”
  2. Configure the “get_values” step (connect your Google Sheets account and enter the Sheet ID and range to retrieve)
  3. Deploy the workflow (this will also generate a unique endpoint URL to trigger the workflow)
    When you load the endpoint, the workflow will return the data retrieved from the “get_values” from Google Sheets step.

I hope this helps!