I am pretty new to Python, and what I’m trying to achieve is to add variables to the payload below in Python; it’s meant for Zeptomail API, and I’m trying to customize and add user-specific data to the payloads ‘merge info’ and the ‘to’ header before sending the email template.
example.py
<code>test_name = 'users name'
test_email = '[email protected]'
test_title = 'users title'
payload = '''
{
n"mail_template_key":"xxxxxxxxxxxxxxxxxxxxxxxxx",
n"from": {
"address": "[email protected]",
"name": "example"
},
n"to": [{
"email-address": {
"address": "test email",
"name": "test-email"
}
}],
n"merge_info": {
"name":"test_name",
"title":"test_title"
}}'''
</code>
<code>test_name = 'users name'
test_email = '[email protected]'
test_title = 'users title'
payload = '''
{
n"mail_template_key":"xxxxxxxxxxxxxxxxxxxxxxxxx",
n"from": {
"address": "[email protected]",
"name": "example"
},
n"to": [{
"email-address": {
"address": "test email",
"name": "test-email"
}
}],
n"merge_info": {
"name":"test_name",
"title":"test_title"
}}'''
</code>
test_name = 'users name'
test_email = '[email protected]'
test_title = 'users title'
payload = '''
{
n"mail_template_key":"xxxxxxxxxxxxxxxxxxxxxxxxx",
n"from": {
"address": "[email protected]",
"name": "example"
},
n"to": [{
"email-address": {
"address": "test email",
"name": "test-email"
}
}],
n"merge_info": {
"name":"test_name",
"title":"test_title"
}}'''
Thank you in advance
I was expecting to add the variable by jsonifying method, but that does not seem to be the case here . I have no experience with the new lines.