Search code examples
emailsparkpostmomentumamp-email

How to disable Substitution data in SparkPost Transmission API


I dont want sparkpost to substitute any data in my email Content. I am sending mails one by one (this is my use case). I am facing issues when my content has {{<some random variable }}, sparkpost tries to substitute it and ignores as the random variable is not present to substitute.

I looked into the below link but I don't think this is good, we have to read whole content to replace two curly braces with this function And there might be some other scenarios also which we don't know yet. https://developers.sparkpost.com/api/template-language/#header-escaping-curly-braces-in-amp-mustache-templates

So is there any way where we can disable any sort of substitution, i just want sparkpost to send my data as it is?


Solution

  • In the transmission Options object add perform_substitutions=false see here

    So something like this:

    {
      "options": {
        "perform_substitutions": false
      },
       :
       :
       :
    

    That will enable or disable substitutions. Can only set to false when using an inline template. Setting to false disables substitution in the text, html, amp, and email_rfc822 content parts and also disables all macros (including snippets ).