transactional single-email

Using https://api.hubapi.com/marketing/v3/transactional/single-email/send, I want to have a variable/placeholder in the template email and supply the value in the API call. I tried putting

{{ my_body }}

in the template email and the following in the API call but not working:

“customProperties”: {“my_body”: “This is a test.”}

Hi @EYi ,

The payload in your API call is correct, however, in the email, you need to specify that you are using a custom token. So instead of using {{ my_body }} you need to use:

{{ custom.my_body }}

Here is my API code that has been tested and works:

 const options = {
 message: {
 to: email,
 },
 customProperties: {
 my_body: 'This is a test',
 },
 emailId: <email ID>
 }

 const url = 'https://api.hubapi.com/marketing/v3/transactional/single-email/send'

 axios({
 method: 'post',
 headers: {accept: 'application/json', 'content-type': 'application/json'},
 url,
 data: JSON.stringify(options),
 json: true
 }).then((response) => {
 resolve(response)
 }).catch((error) => {
 reject(error)
 })

Thank you so much. That worked!