EYi
July 27, 2022, 12:58am
1
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.”}
Teun
July 27, 2022, 7:02am
2
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)
})
EYi
July 28, 2022, 9:08pm
3
Thank you so much. That worked!