Self Referencing Webhook Timeout

Robb_Barrett
Marketo Employee

Self Referencing Webhook Timeout

I'm trying to create a workflow that will update a custom object based off a form submission. 

I can get this to work when I try it through a straight REST call from a program like ARC, so I know I have my components created correctly.

Here's my webhook:

Custom Header:

Header: Content-Type

Value: application/json

Webhook

URL = https://529-FGG-715.mktorest.com/rest/v1/customobjects/interests_c.json?access_token=ACCESS_TOKEN

Request Type: POST

Template:

{

  "action":"createOnly",

   "lookupField":"email",

   "partitionName":"USCAN-US",

   "input":[

  {

"leadID":"{{lead.ID}}",

"productID":"{{lead.Flex Field 1}}",

"productName":"{{lead.Flex Field 2}}"

  }

]

}

Request Token Encoding: None

Response Type JSON

When I trigger a campaign that calls the webhook, I get this error on the lead record. I have no clue why it's timing out. Hoping someone can help.

Webhook Id:

19

Webhook Name:

Multiple Product Interest Population

Request Type:

http_post

url:

payload:

{ "action":"createOnly", "lookupField":"email", "partitionName":"USCAN-US", "input":[ { "leadID":"1455478", "productID":"3", "productName":"Product Interest 3" } ] }

Error Type:

Operation timeout.

Error String:

connect() timed out!

Lead ID:

1455478

Robb Barrett
8 REPLIES 8
Anonymous
Not applicable

Re: Self Referencing Webhook Timeout

Hi Rob,

Did it ever work using webhook? I mean it is not an intermittent issue right?

You may have to write an intermediate web hook service to accept webhook call and call the Rest API from the server.

Worth a try.

Rajesh

SanfordWhiteman
Level 10 - Community Moderator

Re: Self Referencing Webhook Timeout

Loopback POST is not supported AFAIK. The REST endpoints are either specifically firewalled off from inside or are using IPs that are not routable (which has the same effect, even if not deliberate).

You can bounce off an API gateway like AWS or Apigee to easily solve this.

But the bigger problem is the access_token. How are you managing expiration?

Robb_Barrett
Marketo Employee

Re: Self Referencing Webhook Timeout

I thought this was going to be the call!  I'm not sure how to accomplish what you're suggesting. APIs and webhooks are a bit new to me (I'm a Communications major, dangit!) but I'm trying to learn this.

Robb Barrett
SanfordWhiteman
Level 10 - Community Moderator

Re: Self Referencing Webhook Timeout

When you use an API gateway -- a service that proxies your API calls to allow for better auditing and access control, and also to transform payloads if necessary -- the source IP of the API calls is always a public IP, rather than internal within Marketo's network.  It's not what API gateways are really for, but it's a side effect that's beneficial here.

I could set you up with an API gw endpoint easily, but I don't think that's gonna actually result in a usable system for you b/c of the access_token. Webhooks are themselves totally stateless, but you need something to manage the token across requests. That "something" could feed the token to the webhook as opposed to substituting completely for the webhook, but either way you don't have that something (something = an app that maintains the token and refreshes it).

Anonymous
Not applicable

Re: Self Referencing Webhook Timeout

As Sanford Whiteman mentioned, If you write a web hook service code as 'middle man' between webhook call and Rest API call, that code can store the API tokens till expiration and reuse them between webhook calls. The same code can request new API token if it is expired. Bit more work to be done on the server unfortunately, Robb Barrett​.

See Authentication » Marketo Developers

Rajesh

Robb_Barrett
Marketo Employee

Re: Self Referencing Webhook Timeout

So are you suggesting that this might not be the best means to the end for my need to store multiple product interests? Or are you saying that I need an external app that I can trigger via a webhook?

For example, let's say that from a SC I trigger a webhook to an external app that would include all relevant information. I would then need to take that info and feed it back to Marketo from the external app which includes the necessary API information, including the updated access token, etc.

If this is the case, are Custom Objects useless in a Marketo Only environment?

Robb Barrett
Anonymous
Not applicable

Re: Self Referencing Webhook Timeout

Marketo Rest API uses OAuth 2.0 mechanism. That is used widely by most similar solutions. Part of that mechanism is that the authentication tokens expire. Once a token is expired it needs to be explicitly re requested. So they are not 'set and forget'. Due to that one can not use the API calls directly into Webhooks call that is static.

Not a broken or incomplete functionality of Marketo but adherence to the standard.

Does that make sense?

Rajesh Talele

Anonymous
Not applicable

Re: Self Referencing Webhook Timeout

Sanford Whiteman​ is correct in saying that loopback is not supported, and even if it was, you'd have to constantly update the access_token.

An easy option would be to use something like Zapier (https://zapier.com/ ).

You can have the Marketo Webhook, send the data to a Zapier webhook, have Zapier authenticate itself with your Custom Service's details (request a new access token), then post the data back to your custom object REST endpoint along with the new access token. Zapier's able to capture the data you send it in the initial Marketo Webhook, then get the auth token, then map the data from the call and the token to the final webhook template.

You don't really need to code anything, just fiddle with setting up the json templates in the right way.

I've done this to create some many-to-many relationships in Marketo and it seems to work fine.

From an audit view, it will also keep a record of all the calls received and what it did with those.