Execution Time for Webhooks 3 Seconds

Hi, I have a workflow which receives webhooks from Zoom and responds to them with 200OK using custom code indicating that webhook is received.

Zoom expects the 200OK to arrive within 3 Seconds, but I notice that the workflow often takes more than 3 seconds and sometimes more than 7 seconds to execute.

My code has two parts, one where I am responding to Zoom with a 200OK response and then in the second part, I process that webhook data info through the next steps.

My first question is, in the case of Custom HTTP responses,
(1) Do we send the 200OK right away on the execution of that step?
(2) Or We wait for the entire flow to execute before we send the 200OK?

In the case of (1), is there any way that I can send the 200Ok first and then continue executing the rest of the flow?

In the case of (2) is there any way to make my workflow run consistently within 3 second limit?

Code Snippet (Custom response)
await $.respond({
status: 200,
headers: {
‘Content-Type’: ‘application/json’,
},
body: JSON.stringify({}),

Hi @devadmin,

In the case of custom HTTP responses, when you use $.respond(), the response is sent as soon as that step is executed. So, it’s similar to case (1) you mentioned. To ensure that the 200 OK response is sent immediately, you can place the $.respond() step at the beginning of your workflow, before processing the webhook data in the subsequent steps.

However, if your workflow still takes longer than 3 seconds to execute, you might want to consider optimizing your code or breaking down the processing into smaller parts. If you’re still experiencing issues, please share more details about your workflow, and I’ll be happy to help you further.

Here’s an example of how you can structure your code to send the 200 OK response immediately:

export default defineComponent({
  async run({ steps, $ }) {
    // Respond with 200 OK immediately
    await $.respond({
      status: 200,
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({}),
    });

    // Process the webhook data in the subsequent steps
    // Your processing code here
  },
});

Remember that the response is sent as soon as the $.respond() step is executed, so make sure it’s placed at the beginning of your workflow.
I’m a bot powered by Pipedream and GPT-4. I’m still learning, so please double check my answers and code! Learn how to build your own.

Hi, Thanks for the clarification, My custom response is at the first step of the workflow, so it seems to be processed quickly but most of the time I still see Zoom logs showing that 200OK is not received. How can I share workflow details? Is the Workflow ID that you need?

Hi @devadmin, I think your workflow might experience cold start that create a delay when it is not started ror a while.. Would you mind checking the doc ?

@vunguyenhung Yeah, I read that doc. My workflows are getting triggered frequently. Especially, when I am testing, my tests are quite frequent, so I think my workflow is not getting into a cold/inactive state.

I removed all the steps from my flow except the custom flow which doesn’t have any complex code, it is node.js code importing the crypto module, and then sending an HTTP response back. It still takes more than 3 seconds often.

Sometimes, my entire flow runs in less than 1 second while another time, it takes more than 7 seconds. So I was wondering if something can be done to run it consistently within 3 seconds time.

Hey @devadmin, which webhook are you using in your workflow? If you’re using Pipedream’s HTTP trigger, the default Return HTTP 200 OK should immediately respond with 200 on every invocation

Hi @andrew Thanks for your reply. In the case of Zoom Webhooks, the response has to be validated using the secret sent by Zoom in the webhook, so I need to send a custom response only. The custom response is sent in the very next step after the trigger event.

Reference:Using webhooks

“Zoom uses a challenge-response check (CRC) for webhook validation. When a CRC occurs, Zoom makes a POST request to your endpoint with a challenge request body. After your endpoint receives the request, your app needs to respond with the challenge response within 3 seconds.”

Hi @devadmin, could you try to use the Return a static response option in HTTP Response instead?

I think it would be faster than adding the step to response

@vunguyenhung Thanks again for your advice. I tried it but in my case, it is just not the static response I am also doing some processing of the request received from Zoom.

In short, Zoom sends me a challenge, I have to process the response with the API secret, and then respond back to Zoom.

Currently, my workflow responds back within 3 seconds for 20-30% of the requests. Most of the time, it takes more than 7 seconds.

Not sure, if there is any premium feature which can help.

Hi @devadmin, may I ask how often your workflow received event? I’m asking this because there will be a delay called cold starts occur on the first request to your workflow after a period of inactivity (roughly 5 minutes), or if your initial worker is already busy and a new worker needs to be initialized.

If that is the case, you can refer to this link to see how you can solve it