SOLVED

Webhook Timeout Issue - Increase Default Timeout Interval

Go to solution
Highlighted

Webhook Timeout Issue - Increase Default Timeout Interval

Hi,

I am calling an API using webhook, where in few cases API takes more than 30 seconds to complete. Though the API returns success response, webhook returns timeout error.

do we have any procedure to increase the webhook default timeout interval to resolve the issue? or else How to overcome this issue ?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Level 10 - Community Moderator

Re: Webhook Timeout Issue - Increase Default Timeout Interval

Thanks for moving.

There's no way to alter the 30-second timeout.

Generally speaking, the nature of webhooks requires that they execute in a couple of seconds, or 10 seconds at most for rarely called services. Being stateless and oriented toward single requests, webhooks have no session that you can use to check status of a long-running request. And given that only ~8 are executed in parallel, if you're running a 'hook across even a few thousand leads, you need to make sure each call returns quickly.

So the first thing I would do is demand that any API endpoint that claims to be webhook-compatible can conform to these very reasonable expectations.

If you can't fix the endpoint, you can do this:

  • write an intermediate gateway that accepts the webhook connection
  • the gateway connects to the remote API
  • if the remote API finishes in ~10 seconds, the gateway returns the result to Marketo
  • if the remote API is not finished within that time threshold, the gateway returns a Job ID to Marketo instead of the result
  • you store the Job ID in a custom field like LastWebhookJobID
  • the gateway continues to run your long-running calls to the remote API in the background
  • when a call completes, the results are linked with the Job ID
  • Marketo retries the gateway for updates, say querying getQueuedJob?jobId={{lead.LastWebhookJobID}} after 1 minute, and if it's not done, checking again after 5 minutes
  • when you get a final response back, pull the lead out of the Marketo retry flow

View solution in original post

2 REPLIES 2
Highlighted
Level 10 - Community Moderator

Re: Webhook Timeout Issue - Increase Default Timeout Interval

Please move the thread to Products​ to continue (Move link is at the right).

This space is for discussing the Champs incentive program itself, not support.

Highlighted
Level 10 - Community Moderator

Re: Webhook Timeout Issue - Increase Default Timeout Interval

Thanks for moving.

There's no way to alter the 30-second timeout.

Generally speaking, the nature of webhooks requires that they execute in a couple of seconds, or 10 seconds at most for rarely called services. Being stateless and oriented toward single requests, webhooks have no session that you can use to check status of a long-running request. And given that only ~8 are executed in parallel, if you're running a 'hook across even a few thousand leads, you need to make sure each call returns quickly.

So the first thing I would do is demand that any API endpoint that claims to be webhook-compatible can conform to these very reasonable expectations.

If you can't fix the endpoint, you can do this:

  • write an intermediate gateway that accepts the webhook connection
  • the gateway connects to the remote API
  • if the remote API finishes in ~10 seconds, the gateway returns the result to Marketo
  • if the remote API is not finished within that time threshold, the gateway returns a Job ID to Marketo instead of the result
  • you store the Job ID in a custom field like LastWebhookJobID
  • the gateway continues to run your long-running calls to the remote API in the background
  • when a call completes, the results are linked with the Job ID
  • Marketo retries the gateway for updates, say querying getQueuedJob?jobId={{lead.LastWebhookJobID}} after 1 minute, and if it's not done, checking again after 5 minutes
  • when you get a final response back, pull the lead out of the Marketo retry flow

View solution in original post