One of my customers asked if it is possible to reuse the standard dynamics pacer for e-mails on some other channel. They wanted to use SMS, and it would be great to reuse existing functionality which users know and use. I did some research and will provide the API call which you can use to implement a dynamic content parser for your own channels.
Disclaimer: Some of the APIs provided in this article are not officially supported so that they might be changed without prior notice. Please use them on your own risk.
Here is an example of this API call:
OrganizationRequest dynamicParser = new OrganizationRequest("msdyncrm_ResolveMessageTemplate"); dynamicParser.Parameters.Add("ContactId", "{519fccd1-5163-e911-a975-000d3ab98e59}"); dynamicParser.Parameters.Add("ContentSettingsId", "{fadf53a6-3634-e911-a96b-000d3aba0352}"); dynamicParser.Parameters.Add("HtmlContent", "Hello {{contact.fullname}}! Please provide your feedback!"); var result = _service.Execute(dynamicParser);
Code is quite simple. You need to provide several parameters like contact which will be used as a context for this request, Id of your content settings entity and text which parser will try to parse.
Here is how response looks like:
You can quickly parse this JSON using any JSON parser.