Web Service - Methods - EnrolBatchIntoSurvey
EnrolBatchIntoSurvey
This method is used to enrol one or more numbers into an existing TextSurvey.
Using this method, you can supply a different reference for each number, as well as a reference for the batch. These references will be stored along with your enrolled numbers, and will appear in TextSurvey's reports.
For Surveys that use placeholders, this method also allows you to supply placeholder values for each number.
When one or more numbers are passed to this method, the first text message in your survey is sent to the recipient(s).
The first text is either the introductory text, if you have one set up, or the first question of the survey.
On successful completion, this method will return transaction code 1.
If the survey cannot be found, this method will return transaction code 386 (Survey not found).
For pre-pay accounts, if the account does not have enough credit to send the survey’s first questions, this method will return transaction code 387 Questions could not be sent – not enough credit.
If the destinations parameter contains no valid numbers (this includes numbers that cannot be parsed or, for Surveys that do not allow duplicate enrolments, numbers that are already enrolled), this method will return transaction code 388 The destinations parameter contained no valid numbers.
For Surveys that allow duplicate enrolments, if the destinations parameter contains the number of a user that is already enrolled and is currently participating in your Survey, this method will return transaction code 389 The destinations parameter contained numbers that are already enrolled and active on the specified Survey.
The XML response will list the numbers affected. You can either wait for the Participant to finish their Survey, or use the CancelParticipant method to cancel their session. You will then be able to re-enrol them. However please note that if a 389 code is returned none of the numbers supplied in the original request will have been enrolled in the survey. You will need to resubmit these in a subsequent request.
If the EnromentBatchXML parameter is not supplied, this method will return transaction code 405 Enrolment Batch XML missing.
If the XML contained within the EnromentBatchXML parameter is not valid, this method will return transaction code 406 Enrolment Batch XML was malformed. You can check your XML before calling this method, by validating it against our schema, which is available here.
For Surveys that use placeholders, if your EnromentBatchXML parameter contains any Enrolments without placeholder values, this method will return transaction code 407 Survey uses placeholders, but none were supplied.
For Surveys that don't use placeholders, if your EnromentBatchXML parameter contains any Enrolments with placeholder values, this method will return transaction code 408 Placeholders supplied for non-placeholder Survey.
For Surveys that use placeholders, each of the Enrolments in the EnromentBatchXML parameter must contain the same number of placeholder values as the Survey has placeholders. If any Enrolments do not, this method will return transaction code 409 Number of placeholders supplied was less than the number of placeholders on the Survey.
Return Data
XML:
<EnrolIntoSurveyResponse>
<Transaction>
<IP>123.123.123.123</IP>
<Code>1</Code>
<Description>Transaction OK</Description>
</Transaction>
<NumbersAlreadyEnrolledAndActive>
<string>+447980123456</string>
</NumbersAlreadyEnrolledAndActive>
</EnrolIntoSurveyResponse>
XML for transaction code 389:
<EnrolIntoSurveyResponse>
<Transaction>
<IP>123.123.123.123</IP>
<Code>389</Code>
<Description>The destinations parameter contained numbers that are already enrolled and active on the specified Survey.</Description>
</Transaction>
<NumbersAlreadyEnrolledAndActive>
<string>+447980123456</string>
</NumbersAlreadyEnrolledAndActive>
</EnrolIntoSurveyResponse>
CSV:
#1# "1","+447980123456"