AnsweredAssumed Answered

Lead Generation followed by Campaign Triggering via REST API

Question asked by e1c49cecf40b8747b3deab1a998fb066e6f4647c on Feb 13, 2017
Latest reply on Feb 13, 2017 by Sanford Whiteman



    We are using Marketo REST API to (a) CREATE/UPDATE/GET leads, and (2) TRIGGER campaigns. The orchestration workflow is somewhat as follows:


    <1> Based on certain inputs, check whether lead exists, if it does, update certain attributes and trigger a campaign for the same lead id.

    <2> If the lead does not exist, create the lead with all available attributes and trigger a campaign for the same lead id.


    What we are observing is that, when the lead already exists, triggering of campaign is always successful.

    However, when the lead gets successfully created first, and the same lead id is passed as the input to 'POST .../campaigns/{campaignId}/trigger.json', sometimes we receive an error as 'LeadId {} not found'. From the call flow perspective, these are sequential calls that are executed when the prior succeeds.


    Could it be a timing issue? In other words, server has received 'Create Lead' and 'Trigger Campaign' request asynchronously, but 'campaign triggering' gets initiated before server has finished any house-keeping related to 'lead creation'.


    If the same lead is passed again immediately after the previous iteration through the same orchestration workflow, it goes through condition <1> and succeeds.


    Has anyone encountered similar situation? Any advise/feedback on some kind of work-around - maybe a time delay or try logic - would be helpful.


    One of the thoughts/approaches was to introduce a 'wait' in the campaign flow as a starting step, but we are not sure if there would be any other downfalls from the performance characteristics.


Appreciate your feedback and suggestions.