API call for emailing individuals not list on specific date | XM Community
Skip to main content

Hello All, 

I’m using an API call to automate an email reminder for a second survey link on the date provided by each respondent in the first measure of a longitudinal survey. This is working, but it is sending a reminder email to the whole contact list every time a new respondent triggers the workflow. I only want it to send the email to the one participant who specifies that date, on that date. So each respondent only receives one reminder email on the date they previously specified in the first measure (as it is, people would end up with thousands of reminders). I hope that makes sense. 

It can be an anonymous link that goes out because there is an authenticator on the second measure, which seems to be working fine (i.e. the embedded data from measure one is piping through to measure two correctly for specific individuals). But the anonymous link needs to go to the specific participant on their specific date, not to every contact on the list on each date.

I read a post suggesting making an API call to create a mailing list for every individual (so thousands of mailing lists in my case) but it was from six years ago so I wondered if there was a better solution now. If this is indeed the best solution, would I build the call for this into the below, or add another step on the workflow? 

I also wondered if it was an option to add ContactID into the existing cURL, but automate the retrieval of ContactID every time? As the sample size will be large manual is quite unrealistic.

Current cURL as follows: 

Thank you!

curl -XPOST -H 'X-API-TOKEN: <REDACTED>' -H 'Content-Type: application/json' https://<redacted>.qualtrics.com/API/v3/distributions -d '{
"message": {
"libraryId": "<REDACTED>",
"messageId": "<REDACTED>"
},
"recipients": {
"mailingListId": "<REDACTED>",
"directoryId": "<REDACTED>"
},
"header": {
"fromName": "XXX",
"replyToEmail": "<REDACTED>",
"fromEmail": "<REDACTED>",
"subject": "XXX"
},
"surveyLink": {
"surveyId": "<REDACTED>",
"expirationDate": "2028-12-31T00:00:00Z",
"type": "Individual"
},
"sendDate": "${e://Field/adjustedDate}"
}'

 

@Bridget7131,

You can use the Create Distribution API to send a invites to individual contacts.  You can then send reminders to those individual distributions.

For the initial distribution, you’d need to create a web service to get the contact data for all contacts on the mailing list and loop through them to send the invites.  You’ll probably want to save the distribution id in the contact record so you can use it later to send the reminder.


@TomG thank you so much for a quick reply. Apologies for the lack of clarity, my first measure is distributed via anonymous link, and collects the email addresses, which I am storing in a list for authorisation and for the current set up I have. So I can’t use the Create Distribution API to send initial invites unfortunately - I’m ideally looking for something that works after the first measure has been completed and I have my contacts. I used the call on the tutorial you’ve linked to set up what I have working just now, but obviously it is sending to the whole mailing list each time anyone participates.


@Bridget7131,

As part of the same workflow you use to create the contact, you would retrieve the contact lookup id and then use it in the Create Distribution API to schedule a distribution to that contact on a specific date.


Leave a Reply