report the number contacts uploaded and number of emails sent in a (standalone workflow)
HI All,
Following the migration from the old world of Directory > automations (where I used an SFTP process to import a file of contacts and distribute a survey). The screens / reports I get / can see no longer provide the number of lines imported and the number of surveys sent. Is this something I can get to using piped text or something in the flow? I used to review the reports for both import and distribution pages and from that I could easily see if the values matches or (on some occasions) were massively different (we have had three occasions this year now where double the number of surveys have been sent due to issues with Qualtrics’ internal systems repeating the send process for some unknown reason!).
Any thoughts or suggestions (piped text / undisclosed embedded fields / API calls or a code task that could loop through and count even!) would be most helpful
Thanks
Rod Pestell
Page 1 / 1
I think you can use an Email Task to retrieve the Run Summary Report by piping in the text from the previous task.
Thanks for the idea @PraDeepKotian_XM . The piped text reported only gives you the number of contacts inported from say the csv file. The distribution part only gives ids and no other info. So I did a bit of investigation and found that I could get the list of contacts sent an email using the API call: https://fra1.qualtrics.com/API/v3/distributions/EMD_xxxxxxx/history in a webservice task. This is paginated though and so although I’ve managed to create a custom path to get the revised URL to receive the next page of contacts, I am stuck on how I a) create a for each loop within the workflow and based on a webservice task as the starting point, b) concatenating each page’s results together and finally c) count all the elements in order to get a final count of emails sent.
Any ideas on this?
Thanks
Rod Pestell
@Rod_Pestell - You could write your own web service that does the api call, processes the results, and outputs the final count.
@Rod_Pestell - You could write your own web service that does the api call, processes the results, and outputs the final count.
Hi @TomG ,
That’s interesting, do you mean I can create my own webservice within Qualtrics or set up something on our work systems that will listen to an API call from Qualtrics and return the count?
@Rod_Pestell - You could write your own web service that does the api call, processes the results, and outputs the final count.
Hi @TomG ,
That’s interesting, do you mean I can create my own webservice within Qualtrics or set up something on our work systems that will listen to an API call from Qualtrics and return the count?
You would create the web service on your own web server that would do the Qualtrics API call (e.g., curl), process the results, and output the count in a json string.
Hi @Rod_Pestell - If you are just looking for overall counts from the email distribution, could you use the Get Distributions endpoint to get the counts? It looks like those are returned in the “stats” section of the response body.
Since the workflow does not allow you to pull the email tasks’ distribution ID (which is needed for Get Distributions endpoint), I believe you would need to use the List Distributions endpoint to get the distribution ID. This could be potentially done by filtering to the mailing list and distribution date if you are triggering this workflow once a day for example. The response also seems to be in reverse chronological order so your distribution should always be returned first in the list of distributions in the response body.
WebService task to list distributions and return the Distribution ID of the distribution that was generated in the email task above
WebService task to get the stats of the Distribution ID retrieved from WebService above
That’s great - thanks for the advice @jake_dufinetz - I will look into that. I guess you could then use a code task to review the array / json and filter by date and mail list to get the info needed. Only done simple stuff in the code task so will have to have a play!
Thanks again
Hi @jake_dufinetz
I stumbled at the first hurdle…. I used the test window of the API page and it returned empty
(spotted the date string was End first then Start - but still no difference even trying to reverse them!)
I got the mailing list ID as you suggested by the piped text fields on an email when I ran the workflow so I’m pretty sure that’s correct. I tried choosing different date ranges and distributionRequestType choices but still blank.
And it appears to have the values i need which is great. So I’ll continue to work out how to get that out of the JSON output but if someone could test the call https://api.qualtrics.com/234bb6b16cf6d-list-distributions that would be great
Thanks
Hi Rod,
Since the mailing list ID is an optional field, do you need it as a filter for your use case since you are already filtering by survey ID and send date? That parameter may require a different ID than Mailing List ID for distributions to transaction batches, but I’m not sure.
Hi @jake_dufinetz
I stumbled at the first hurdle…. I used the test window of the API page and it returned empty
(spotted the date string was End first then Start - but still no difference even trying to reverse them!)
I got the mailing list ID as you suggested by the piped text fields on an email when I ran the workflow so I’m pretty sure that’s correct. I tried choosing different date ranges and distributionRequestType choices but still blank.
Does it work for you?
Thanks
@jake_dufinetz aha! I didn’t realise! As soon as I removed the maillinglistD it worked. Thanks for that. I’ll go away and work out the rest hopefully now. Thanks again.
Hi @Rod_Pestell . I just completed a successful test to pull that stats into a notification email. See the setup below. After picking up your invite file and distributing, you have 3 tasks.
Get Distribution ID
Get Distribution Stats
Send distribution stats email
Note that the output will display as the string below, but you could probably transform it to something more readable with a code task.
Thanks for testing @jake_dufinetz . My code is now working - was struggling getting the details out of the JSON code - the Qualtrics system doesn’t really help you if don’t know what you are doing!! My problem is now that the webservice call needs to be run after a slight delay or else it reports a lower figure as not all the surveys have been sent. Is there a way to delay the flow at that point? Below is a pic of my flow. I found I only needed to call up one API https://fra1.qualtrics.com/API/v3/distributions?surveyId=…...
or is perhaps because I’m only calling up this one API and not using the other one the problem for the low count?
1 - populate some variables, survey ID, sendStartDate and sendEndDate
3 - code that grabs the above variables via piped text var raw = `~{ch://OCAC_DXu1CB6TTUvy2my/$.result.elements}`; <<<<note the back ticks which are required to keep it as a string (can’t use double quotes as that is already in use in the string!). The rest of my code then handles the scenario of whether it’s just one distribution or multiple distributions (ie a single element vs an array).
Any feedback on my code below would be most welcome. There might be a simpler way of doing it but it’s what seemed to work! PS had a little help so I can’t claim all rights to this code!! ;)
Note mailingListId in my scenario is the batch id as it’s an automated procedure ie Starts with BT_. This might differ from one type of distribution to another.
function codeTask() { var raw = `~{ch://OCAC_Dxxxxxxxy2my/$.result.elements}`; var jsonData;
// Handle both array or nested .result.elements structures var arr; if (Array.isArray(jsonData)) { arr = jsonData; } else if (jsonData && jsonData.result && jsonData.result.elements) { arr = jsonData.result.elements; } else { arr = []; }
var mailingListId = "~{ch://OCAC_gCxxxxxxxxxxBy/BatchId}"; var match = null;
// Find the matching element safely for (var i = 0; i < arr.length; i++) { if (arr[i].recipients && arr[i].recipients.mailingListId === mailingListId) { match = arr[i]; break; } }
var statsSent; if (match && match.stats && typeof match.stats.sent !== "undefined") { statsSent = match.stats.sent; } else if (match) { statsSent = "sent not present"; } else { statsSent = "Mailing list not found"; }
If you need a delay before running your API call, you could use a webservice element in your workflow (passing the variables you need) to trigger a second workflow via a json event. Add a delayed start to that second workflow (15 minutes should be enough and is the smallest increment) and run your API call(s) in the second workflow.
Best,
Hi @vgayraud Never used a JSON trigger so will look into that. I did have another idea just now which was to put in another email task before the first code task as I realised you could put in a delay of 1 hour for that. I am not sure if that will hold up the rest of the steps so we will see. I’ll report back next week :)
Thanks.
Hi,
The delay on the email won’t help you. It only sets the distribution time later, it doesn’t actually pause the workflow.
I’m curious tho, wouldn’t a funnel data dashboard be enough for all your reporting needs?
Hi @Rod_Pestell - Agree with @vgayraud on the method to delay triggering the distribution API call by calling a secondary workflow with a JSON endpoint trigger that runs at a slight delay from when it is triggered.
Hi,
The delay on the email won’t help you. It only sets the distribution time later, it doesn’t actually pause the workflow.
I’m curious tho, wouldn’t a funnel data dashboard be enough for all your reporting needs?
@jake_dufinetz We have the funnel setup but it’s a clunky dashboard which I don’t always look at on a regular basis. I use it more for trends over a longer time to be honest. So I wanted to have an email report for each distribution so that we can keep a closer eye on the duplicate sends that keep occurring. Qualtrics keep promising me they’ve fixed it but it then happens again and they keep finding another issue which they then have to fix. Not used this type of trigger before - I presume using the JSON link would require you include the survey ID and batch ID. I also assume this task is kept internal to Qualtrics servers and it’s not like broadcasting the data to a www?!
Thanks
Hi Rod,
You could easily build a table in your funnel data with all the info:
For the JSON event, it’s usually used so that Qualtrics listens for calls coming from an external system, but there’s nothing against using it to have it calling itself.
The way this is set up is pretty simple.
1st workflow will look a bit like this:
2nd workflow:
Hi @vgayraud & @jake_dufinetz,
Thanks for your reply. I now remember the reason why I’m not using the funnel for this purpose. It doesn’t tell you the true number of rows imported. Please see my example below
On 25th September the system sent the contents of the file we uploaded twice. This has happened before a month or so ago and then earlier in the year and creates duplicate responses for the guests who responded to both emails (our guests like to send us feedback!!). Qualtrics have found some internal issues and are busy fixing it but in the meantime I still need to monitor it. If you compare the Distributions API and also the survey’s distributions, the numbers don’t show you the true import number (when the issue occurs).
left: old directory automation import summary. right table from distribution funnel dashboard first two columns showing imported and sent values (they are always the same!). Below: Distributions API report for 25th Sept.
As you can see the true number of rows imported was 431 yet both the API and funnel report 817. When you download the distribution history file you can see that duplicates were sent which add up to 817. So this is why I want to create a flow that reports the SFTP task rows imported and also include the distributions API report all in one place. I will monitor this through an email and may also then think about exporting it to csv to keep a record and track things over time more easily. I guess I could load it to an imported table in Qualtrics and make my own proper working funnel!!
I had a go with the JSON task as suggested and a separate flow and got it working, so today is the first test and I’ll then fine tune it as no doubt I’ll have to take into consideration errors and failures that may occur.
Hopefully this explains the main reason for why I am doing all this and I’m hoping it will make it easier to monitor the issues that Qualtrics are (openly?) having when sending emails. I would be keen to know if anyone else is having the same intermittent issues?