hope you all are doing well.
I need to create a complex request body. My api call will take different email addresses from a CSV file and send a email notification to the listed email addresses in the request body. But the number of the email addresses will change based on the input provided by the user. My requirements are like this:
- CSV data that contains different email infos. (I have that)
- The number of email addresses in the request body will be between 10 - 1000 (I thought about using a user defined variable for that)
- All the email addressed will be listed in the request body.
- An incremental id will be assigned to all email addresses.
So the structure of my request body should be like this:
"message_job_id": "28b0a005-9ef1-475c-b33c-ade900f19e4c",
"campaign_group": "Entegrasyon",
"template_id": "cf585c8c-c675-40d2-b88a-ade900c898d5",
"recipient_list": [
{
"customer_id":"${target_id1}",
"target":{ "address": "${email1}" }
},
{
"customer_id":"${target_id2}",
"target":{ "address": "${email2}" }
},
{
"customer_id":"${target_id3}",
"target":{ "address": "${email3}" }
},
{
"customer_id":"${target_id4}",
"target":{ "address": "${email4}" }
},
..........
{
"customer_id":"${target_idX}",
"target":{ "address": "${emailX}" }
}
X will be defined by the user input.
Any idea how can I do that?
Thanks...
My CSV sample:
Reading CSV successfully finished, 20 records found:
${id} = 1000011
${email} = a1000011@smartmessage.com
------------
${id} = 1000012
${email} = a1000012@smartmessage.com
------------
${id} = 1000013
${email} = a1000013@smartmessage.com
My output payload:
"message_job_id": "28b0a005-9ef1-475c-b33c-ade900f19e4c",
"campaign_group": "Entegrasyon",
"template_id": "cf585c8c-c675-40d2-b88a-ade900c898d5",
"recipient_list": [
{
"customer_id": null,
"target": {
"target": {
"address": null
}
}
},
{
"customer_id": null,
"target": {
"target": {
"address": null
}
}
},
{
"customer_id": null,
"target": {
"target": {
"address": null
}
}
},
{
"customer_id": null,
"target": {
"target": {
"address": null
}
}
},
{
"customer_id": null,
"target": {
"target": {
"address": null
}
}
},
{
"customer_id": null,
"target": {
"target": {
"address": null
}
}
},
{
"customer_id": null,
"target": {
"target": {
"address": null
}
}
},
{
"customer_id": null,
"target": {
"target": {
"address": null
}
}
},
{
"customer_id": null,
"target": {
"target": {
"address": null
}
}
},
{
"customer_id": null,
"target": {
"target": {
"address": null
}
}
}
]
}