Help needed sending survey links in the message body when creating a distribution | XM Community
Question

Help needed sending survey links in the message body when creating a distribution


Hello! I am trying to create a process to create survey distributions via the Qualtrics API.
I have things working all the way to the end (creating a mailing list, populating it with contacts, and a couple other steps) using the API, but I am not able to figure out how to get the body of the email to contain the links to the distribution. The body simply contains the contents of the messageText, and not links to the survey.
I suspect that I need to replace messageText with the idea of a previously-created message, but I haven't been able to figure out what API calls are used to create this message, or wher ein the Qualtrics I could create a message whose ID I could use. Could anyone send me some pointers to what I need to do to set the message body to contain the links to the survey?
I am using Ruby on Rails. My request body in JSON is below (with some items showing the variables in the RoR code). The ENV[] variables as well as the library_id, mailing_list_id and survey_id are all set correctly and I am able to send a message to all recipients in the mailing list. I just don't understand how to send out links to the survey instead. Thanks for any assistance or pointers you can give!
JSON Body:
{
        method: :post,
        url: url,
        headers: {
          "content-type": "application/json"
        },
        body: {
          "message": {
            "libraryId": library_id,
            "messageText": "Message Body Here"
          },
          "recipients": {
            "mailingListId": mailing_list_id
          },
          "header": {
            "fromEmail": ENV['QUALTRICS_FROM_EMAIL'],
            "replyToEmail": ENV['QUALTRICS_REPLY_TO_EMAIL'],
            "fromName": ENV['QUALTRICS_FROM_NAME'],
            "subject": ENV['QUALTRICS_SUBJECT']
          },
          "surveyLink": {
            "surveyId": survey_id,
            "expirationDate": expiration_time,
            "type": "Individual"
          },
          "sendDate": Time.now.utc.iso8601
}


0 replies

Be the first to reply!

Leave a Reply