Open jdeblank opened 4 years ago
Hey Josh!
Thanks for creating an issue! :o)
Just wanted to send.a quick follow up to let you know we saw this. A colleague is going to be posting a detailed comment for the Sales Cloud Activity portion sometime tomorrow.
In general, you can achieve consuming returned data by using the data binding syntax in Journey Builder for some activities.
Data Binding allows you to bind an activity to data in a running journey. The Marketing Cloud built the syntax for Data Binding on the Mustache template language library.
An example of this can be observed in the 'Code Engagement' example. In the UI of the 'Code Engagement' activity, when selecting from a dropdown of available outArguments from previous activities, it generates a data binding expression that represents the 'discountCode' emitted from the Coupon Code REST activity placed previous on the canvas to be used as input.
The data-binding syntax will result in something that looks like {{Interaction.REST-1.discountCode}} where 'REST-1' is the unique key associated with the activity that is emitting the outArgument. This expression will resolved when each contact is executing through the journey and will use the value that was sent back on the discountCode field of the HTTP request for that contact.
Both Sales Cloud Activities and Update Contact activities support data binding syntax but is not immediately available to the end user as options, meaning in it's current implementation the user would need to construct the expression and type it in manually.
In order to get a list of available Journey Data on an existing journey, you can browse to Settings -> Data tab and see the Journey Data fields. The activity key is admittedly a bit hidden, and either requires the use of the Journey Builder API to get the unique activity key (ie REST-1) or inspect the markup of that settings page which lists the Journey/Activity data available.
Documentation for data binding here: https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/how-data-binding-works.htm
Documentation to get Journey by id: https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-apis.meta/mc-apis/getInteractionById.htm
With all that said, let me know what could use further explanation/clarification.
The Journey Builder data binding syntax does not apply to the e-mail activity as e-mail has it's own personalization and/or ampscript mechanisms, so am clarifying internally what the suggested approach should be there.
Would be good to get some answers on use in Email. The last advice I got was that the custom activity should send an API call to a SFMC data extension which could be referenced via AMPscript but this clearly comes with risks and large API volume. Would be good to get alignment from both teams as it isn’t the first time we were told it was possible only to find out it’s not :(
Howdy!
Would be good to get some answers on use in Email. Would be good to get alignment from both teams as it isn’t the first time we were told it was possible only to find out it’s not :(
You can update a data extension with the information received by the Rest Activity.
EX:
Special Note:
REST-1
is case sensitive and can be found by inspecting your Journey's Activity IDs.
Then you can look up that information from the data extension with AMP Script. https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-programmatic-content.meta/mc-programmatic-content/lookup.htm
We are currently researching with the product team to see if there is a better way to accomodate this specific flow so the user experience will be easier to follow with less steps.
Hey @smashew did we end up with a more user friendly answer around email personalization? The workaround (data binding with update contact activity) isn't all that user friendly, and I was even advised not to do it (not exactly sure why) so not sure we should consider this a good solution. I find it a bit strange no one noticed this before :(
We are going to have to put the more concise solution on our roadmap. We will keep this issue posted and updated!
Hey @smashew wondered if there was any update for us?:)
hey @smashew wondered if there was any update for us?:)
Hi @DougMidgley, I've been thinking over this as well and how to establish some reference patterns.
Ask ourselves, what are the needs of working with external platforms? So far I have:
Trigger an event in an external platform or send messages to customers via external platforms (e.g. WeChat) This is possible with a standard Custom Activity.
Pull in data to be used in the journey flow control I've seen others attempting to do this via a API call as you described earlier (i.e. upload data to a DE via API), but it's not necessary and you should use custom decision splits for this.
Update Contact data from an external source This is exactly what the "Update Contact" activity is for and the solution is described above.
Use external data for personalisation This seems to be what you're looking to do. Personalisation isn't handled by Journey Builder, so this isn't something that a Custom Activity would do.
There are multiple options to use external data in messages by using AMPScript. Your specific use case will likely influence which is the right one for you, but in summary you could use:
Hey, Yea its indeed the last one which is the main thing which im looking at. Using Ampscript functions to get external content is usually considered poor practise so we wanna try and avoid that :( The only real way is to have logic to update some specific data extension with a 1:1 relationship, but that whole process itself has risks and limitations. Essentially, all we want is that Journey Data is accessible inside of content, and the whole thing would be solved. Seems like this is an obvious idea tbh. Given there seems to be absolutely no interest in Salesforce delivering on this, we are often doing the HTTPGet functions options even if poor practise :(
Hi @DougMidgley
...Ampscript functions to get external content is usually considered poor practise
That's not strictly true. It's a documented and supported AMPscript function. Without Journey Builder this would be your only option. In fact, it's provided as an official example in the developer docs. There is also an out-of-the-box content block for pulling external data to use in an email at send time. The help docs provide an example of using personalised data in an email at send time.
If you have high volume and performance is a concern, you don't have to generate content and return it all in one call. E.g. you call the Custom Activity to trigger the generation of a a promotion code and pass the data to a faster cache (such as Heroku Redis). Then use the external block (or AMPscript HTTPGet) to pull the data for said customer at high speed
The only real way is to have logic to update some specific data extension with a 1:1 relationship, but that whole process itself has risks and limitations.
I'm not sure I understand. Can you explain your use case to me and what your risks/limitations are? As these are two separate functions (orchestration & personalisation) it makes perfect sense to me that each tool does what it does best.
Hey @MagicPepsiCan To the point on callouts in AMPScript, I do definitely see the use cases where this could be optimized, but for large volumes of email you would really wanna be careful about time to execute as each call would have to be highly performant. I'm not sure how well that would all do, and testing/optimizing everything for that volume would be hard to mock. That said, it indeed may be the only option you are left with. For second point, you could for example, have a custom activity which calls out to do processing, and then before returning, calls back to SFMC to set a value in a data extension. Assuming that you want to send the email right away, this also will take some time so it also will end up throttling the throughput. Once in the data extension, you can query that via AMPscript directly if you need to access it within the email. The main concern i would see here is that since you do not have any information about the journey context within the email, you may end up writing multiple values to the same data extension and overwriting them (think for example where the same person is multiple times in the same journey), which may result in the content being displayed being incorrect. Of course, also in this case, you could do some workarounds, such as having event keys in the entry event to make each entry "unique" but it isnt always possible and also increases complexity.
All in all, there is always workaround for this, but being able to just use the response would be the most straightforward way to do personalization and its a pity that the journey builder and email teams cannot work together on the use case imho :(
One of the questions asked during the recent Technical Marketers Monthly Meeting was how can returned data (such as the coupon code in the example) be used in an email? Is it with ampscript? It was mentioned in reply that perhaps an example would be created to demonstrate.
So just a ticket to request follow up on that question. Please. 😄
Also a similar question, can returned data also be used in a Sales/Service object activity or an Update Contact activity? If so, how?