In this article, you will learn step by step how to send a mailing to multiple respondents. I describe what operations to use, in what order, and how to link them together into a logical whole.

I will skip the issues related to authorization and logging into the account. I assume you know how to do this.


Survey

I also assume that you know the ID of the survey you will be inviting to. If you don't know your survey ID, it is the number that appears in the basic survey link, e.g.:

https://www.customerhero.com/survey/123456/ankieta-satysfakcji.html

123456 is your survey ID.

Alternatively, you can use the API operation to retrieve the list of surveys on your account. In the response, you will get your survey ID.



Importing respondents and sending the mailing

  1. We create a batch (process) to which we will add respondents. Details can be found in the documentation of the /api/v2/respondents/batch operation.

  2. We save the batch_id parameter, which we will receive after calling the batch creation operation.

  3. We send the batch_id to the /api/respondents/patch operation, along with the respondent data. We call this operation as many times as needed until we load all respondents for the mailing in consecutive packages. There is no limit on the number of respondents here.

  4. After uploading all respondents, we create a mailing using the batch_id. The operation for this is: /api/v2/mailings/batch.

  5. In the call to this operation, we pass the batch_id from the first operation and the id_template of the message template you want to send.

  6. We check if the mailing has been defined correctly using the /api/v2/mailings/:mailingId method, where we substitute mailingId with the returned mailing ID. The mailing can be in one of the following statuses: preparing (if you have loaded a lot of respondents, the mailing request may take a while), waiting/pending (if the mailing is already prepared and waiting to be sent), or sent (if your mailing has already been sent).

If you don't know where to get the template_id from, we describe it in this article.