Re: How to use a webhook to pull data from our database for a program my.Token?

Anonymous
Not applicable

How to use a webhook to pull data from our database for a program my.Token?

As the title says, we are trying to setup an email campaign. The campaign should get new content for the tokens in the body of the email, and then send the updated email.

How should we do this? Can we?

We are OK on our side with the API and everything, we are just not sure how best to create the webhook, and how to get it to map the response from our database to myEmailContent tokens in the email template.

Thanks,

Tags (2)
11 REPLIES 11
Grégoire_Miche2
Level 10

Re: How to use a webhook to pull data from our database for a program my.Token?

Hi Issa,

You will need 2 smart campaigns in fact:

  1. The web hook call the external web service. When the value is returned the webhook updates the lead field. Remember webhooks are asynchronous. This means you cannot know how long it will take to return the value and update the field.
  2. So you will need to use a second smart campaign that triggers on a "data value changes" on the updated lead field, sends the email and wipes out the updated lead field (in case you want to run it again).

-Greg

Anonymous
Not applicable

Re: How to use a webhook to pull data from our database for a program my.Token?

Hi, thank you.

So, what this sounds like is that we can only update Lead and System tokens, not custom Program tokens?

Setting aside the Webhook. Is there ANY way we can have a campaign update the content in a body of an email at the time of send?

I.E. A daily email - When we hit "run once" in the dashboard, the program should request the data for the tokens, fill in the email template, and send.

But my understanding is that we cannot pull the custom tokens in this way - they must be pushed from the external system into Marketo, and when that happens, the external push inherently has to trigger a send immediately. Is this correct?

Any thoughts?

Issa

Anonymous
Not applicable

Re: How to use a webhook to pull data from our database for a program my.Token?

And when I say "get the content for the tokens" I'm referring to program tokens. I've setup the email to retrieve all it's content from our database.

Thanks,

Grégoire_Miche2
Level 10

Re: How to use a webhook to pull data from our database for a program my.Token?

Hi Issa,

Yes you can change a program token, but not through a webhook response mapping. What you can do is have you web service call the "Request campaign" Rest API call (http://developers.marketo.com/documentation/rest/request-campaign/ ) that can call a smart campaign and pass a value for a {{my.token}}. The value of this {{my.token}} will only be used for this campaign call, it will not be stored in Marketo. But if the smart campaign sends an email, the {{my.token}} can be used in the email, and it will be populated with the temp value. Your smart campaign will have to sit in a program in which the {{my.token}} is defined.

-Greg

Anonymous
Not applicable

Re: How to use a webhook to pull data from our database for a program my.Token?

Ah, in this case though, the call to the original request campaign still has to come from an external source? And when you say it can be used in that program temporarily - does that mean the smart campaign containing the my.Token has to automatically send the email then - or can the email be sent later? I.E. Our web service calls the Request Campaign which updates the smart campaign at 9am, and the smart campaign is sent either with a schedule or manually later that day at noon?

Thank you again!

Grégoire_Miche2
Level 10

Re: How to use a webhook to pull data from our database for a program my.Token?

Yes, the call has to come from an external source.

Yes, the token value is valid only for the emails send from the campaign. But that smart campaign may use a "wait" until it's time to send the email.

-Greg

SanfordWhiteman
Level 10 - Community Moderator

Re: How to use a webhook to pull data from our database for a program my.Token?

Issa, while technically feasible out of context, this approach is only going to work for small sends.  You only get 10,000 API calls per day across all your integrations, and every Request Campaign call is going to consume 1 call.

I consider the Request Campaign API a way to send controlled-volume transactional emails via Marketo -- say, notifications to authenticated users of a web app -- instead of having to send them via your corporate mailserver or another ESP.  It's not something I would use to trigger a high number of individual campaign runs via webhooks (note you can in fact run Request Campaign for 100 leads at a time, but this will not be possible via a webhook which runs once for every lead).

In contrast, the Programs API can be used to update a single shared {{my.token}}, and then Schedule Campaign can be used to kick off a an existing campaign.  This only takes a few API calls and is far more efficient.  But the calls would have to be scheduled from an external source (not too tough to build, but your dev would have to maintain a schedule instead of being merely reactive)

Anonymous
Not applicable

Re: How to use a webhook to pull data from our database for a program my.Token?

Thank you to both of you. What we are trying to do is trigger a daily newsletter. So we want the entire contents of the email to come from our database, the email populates with that data (somehow), and the campaign sends to our smart list which could be as many as 500k leads or more.

It's sounding more and more like this is not feasible in Marketo...? While not ideal, we could trigger the campaign externally if that's the only way. But it would need to populate 5-10 separate tokens in the email, and then send to many leads. What are your thoughts on how we can or if we can accomplish that?

Sorry to keep going over and over this, but your expertise is extremely helpful.

Thank you again.

SanfordWhiteman
Level 10 - Community Moderator

Re: How to use a webhook to pull data from our database for a program my.Token?

I wouldn't say it isn't feasible, though it isn't feasible with Request Campaign.

It's not the way the vast majority of people use Marketo, and even within the small group of people who use the Programs API, few if any use it for daily updates to program tokens (instead using it for permanently setting values or maybe periodic updates, but not daily).

But, that being said, Marketo can do what you want using the concept I outlined above (Programs API + Schedule Campaign).  If you're already paying for Marketo so those 500K leads can receive "managed" marketing efforts, then the daily newsletter is a reasonable addition (assuming, of course, that it is opt-in and does not ding your sender reputation).