Queue Maketo Lead API calls

Jyotsna_Gupta1
Level 1

Queue Maketo Lead API calls

Hi,

We have built a script in PHP to remove duplicates from our Marketo instance and calling that script through webhook (via smart campaign). In that script we are first pulling the lead information and sometimes when that script is doing around 100 API calls in 1 minute to Marketo API, Marketo API stops responding and give the below error (attaching screenshots of the code and error)

pastedImage_3.pngpastedImage_1.png

Wait step in campaign doesn't seem to work.

Could you please tell how can we queue these Marketo API calls or any other workaround for this?

Thanks,

Jyotsna

2 REPLIES 2
SanfordWhiteman
Level 10 - Community Moderator

Re: Queue Maketo Lead API calls

The error you're showing is from your PHP server, not Marketo. It results from a caught exception in a function you aren't showing here. So until you show the actual HTTP- or socket-level error from the Marketo connection it's impossible to confirm your experience.

In any case, the REST API rate limits are very clear: 100 calls per 20 seconds. So if you actually spaced your 100 calls out over 1 minute you wouldn't exceed them. But if the calls were packed into the first 20s of a minute, you would.

Could you please tell how can we queue these Marketo API calls or any other workaround for this?

You have to rate limit your outbound calls to Marketo. If you're getting too high a rate of inbound webhook requests to turn every one into an outbound API request, then in your code you need to make sure to end connections early if opening a resulting outbound PHP connection(s) to Marketo would cause you to go over the limit (and have retry logic in your Smart Campaign to reprocess people after a delay).

Also, when posting code here, please use the Advanced Editor's syntax highlighter, not a screenshot.

https://s3.amazonaws.com/blog-images-teknkl-com/syntax_highlighter.gif

Elliott_Lowe1
Level 9 - Champion Alumni

Re: Queue Maketo Lead API calls

Other alternatives are to bulk deduplicate via Salesforce using a third-party app such as RingLead DMS. The ideal scenario is to prevent the duplicates in real-time, which can also be done via RingLead DMS on new records imported to Salesforce or created by users in Salesforce. RingLead also has a webhook that can clean up duplicates as they enter Marketo.