Send SMS Engage surveys as batch

POST https://sms.8x8.com/api/v1/subaccounts/:subAccountId/surveys/:surveyId/messages/batch
  • Sending a POST request on this endpoint allows to send SMS Engage surveys by batch (multiple messages per request).
  • It is ideal when you want to send a batch of surveys on a recurring manner or based on time parameters (eg: Order collection at the end of the month)

URL

  • The 8x8 subaccountid to use is defined in the URL where you send your POST request as shown below: https://sms.8x8.com/api/v1/subaccounts/{subAccountId}/surveys/{surveyId}/messages/batch

Request

Path Parameters

    subAccountId stringrequired

    Possible values: >= 3 characters and <= 50 characters, Value must match regular expression ^[A-Za-z0-9\-._&]{3,50}$

    You must replace {subAccountId} with the subaccountid that you want to use. By default this is generated once you signed up with a new account at https://connect.8x8.com.

    surveyId stringrequired

    The surveyId will be provided to you by 8x8. This Id is a unique name of your SMS-to-Form which 8x8 creates based on the use-cases you defined.

Header Parameters

    Authorization password
    • 8x8 SMS API accepts an ApiKey Bearer Token authentication method.
      • You can generate apiKey tokens from your customer portal https://connect.8x8.com/
      • You need to include the following header in your requests: Authorization: Bearer {apiKey}
        • NB: (replace the {api=key} placeholder with the key generated from the customer portal)

    If you haven't created your account yet, please go to 8x8 website https://connect.8x8.com to sign up.

    Default value: {$$.env.Authorization}

Body

    clientBatchIdstring

    Client managed id for this batch of messages : your own unique reference

    Possible values: <= 20 characters

    messages object[]required

    Possible values: >= 1, <= 10000

  • Array [
  • destinationstringrequired

    MSISDN (destination mobile phone number). We accept both international and national formats (for national you have to specify country in the dedicated field).

    Possible values: Value must match regular expression ^\+{0,1}[1-9]{1}[0-9]{6,14}$

    countrystring

    Optional country code of Destination number(ISO 3166-1 alpha-2), if you know it. It will help to convert number from national to international format

    Possible values: >= 2 characters and <= 2 characters

    templateBodystring

    Template of message to user. It should have the variable {{url:}} which is the default link set for you by 8x8

    templateVariables object

    variables or pre-defined fields used inside the templateBody

    object
    sourcestring

    Source number (SenderId) - "From:" field for the SMS

    Possible values: <= 16 characters

    clientMessageIdstring

    Client managed id for the message: your own unique reference

    Possible values: <= 350 characters

    encodingstring

    Encoding for the text of the message

    Possible values: [AUTO, GSM7, UCS2]

    Default value: AUTO
    scheduledstring<date-time>

    Date and time when a schedule delivery of the message must happen

    expirystring<date-time>

    Date and time after which a message cannot be sent

    dlrCallbackUrlstring<uri>

    Webhook URL where delivery status for the SMS will be posted (Overwrites your default account callback URL).

  • ]
  • template object

    templateBodystringrequired

    Template message body

    sourcestring

    Alphanumeric or numeric string used as Sender ID for the template

    Possible values: <= 16 characters

    encodingstring

    Encoding of the message text. In most cases just useAUTO. 8x8 SMS platform will automatically identify the required encoding.

    Possible values: [AUTO, GSM7, UCS2]

    Default value: AUTO
    scheduledstring<date-time>

    Date and time when a schedule delivery of the message must happen.

    expirystring<date-time>

    Date and time after which a message will be discarded if it is still in processing.

    dlrCallbackUrlstring<uri>

    Webhook URL where delivery status for the SMS will be posted (Overwrites your default account callback URL).

    includeMessagesInResponseboolean

    Determines whether the reponse should include individual details for each message sent

OK

Schema

    batchIdstring<uuid>required

    Unique batch id (guid) generated by 8x8 SMS platform upon batch submission

    clientBatchIdstring

    Client managed id for this batch of messages : your own unique reference

    acceptedCountintegerrequired

    Amount of accepted messages

    rejectedCountintegerrequired

    Amount of rejected messages

    messages object[]

    List of processed messages (if flag includeMessagesInResponse=true)

  • Array [
  • umidstringrequired

    Unique message id (guid) generated by 8x8 SMS platform upon message submission

    destinationstringrequired

    Mobile phone number (MSISDN) to which the SMS was sent

    Possible values: Value must match regular expression ^\+?\d{7,15}$

    status objectrequired

    codestringrequired

    Code for the SMS delivery status.

    Possible values: [QUEUED, REJECTED]

    descriptionstringrequired

    Explanation for code.

    encodingstringrequired

    Detected message encoding. Useful when sending initial request with encoding=AUTO

    Possible values: [AUTO, GSM7, UCS2]

    clientMessageIdstring

    Your custom identifier for the message

  • ]
{
"batchId":"f1ea5276-a824-e711-8146-022a22cc1c71",
"clientBatchId":"SmsApi-Demo1",
"acceptedCount":3,
"rejectedCount":1,
"messages":[
{
"umid":"f2ea5276-a824-e711-8146-022a22cc1c71",
"clientMessageId":"SmsApi-Demo1/6500000001",
"destination":"6500000001",
"encoding":"GSM7",
"status":{
"code":"QUEUED",
"description":"SMS is accepted and queued for processing"
}
},
{
"umid":"f3ea5276-a824-e711-8146-022a22cc1c71",
"clientMessageId":"SmsApi-Demo1/6500000002",
"destination":"6500000002",
"encoding":"GSM7",
"status":{
"code":"QUEUED",
"description":"SMS is accepted and queued for processing"
}
},
{
"umid":"f3ea5276-a824-e711-8146-022a22cc1c71",
"clientMessageId":"SmsApi-Demo1/6500000003",
"destination":"6500000003",
"encoding":"GSM7",
"status":{
"code":"QUEUED",
"description":"SMS is accepted and queued for processing"
}
}
]
}
{
"batchId":"f1ea5276-a824-e711-8146-022a22cc1c71",
"clientBatchId":"Demo#1001",
"acceptedCount":3,
"rejectedCount":1,
"messages":[
{
"umid":"f2ea5276-a824-e711-8146-022a22cc1c71",
"clientMessageId":"Demo#1001/6598760001",
"destination":"6598760001",
"encoding":"GSM7",
"status":{
"code":"QUEUED",
"description":"SMS is accepted and queued for processing"
}
},
{
"umid":"f3ea5276-a824-e711-8146-022a22cc1c71",
"clientMessageId":"id_100001",
"destination":"659876002",
"encoding":"GSM7",
"status":{
"code":"QUEUED",
"description":"SMS is accepted and queued for processing"
}
},
{
"umid":"f3ea5276-a824-e711-8146-022a22cc1c71",
"clientMessageId":"id_100002",
"destination":"33509750003",
"encoding":"UCS2",
"status":{
"code":"QUEUED",
"description":"SMS is accepted and queued for processing"
}
},
{
"umid":"f3ea5276-a824-e711-8146-022a22cc1c71",
"clientMessageId":"id_100003",
"destination":"+12025550127",
"encoding":"GSM7",
"status":{
"code":"REJECTED",
"description":"Invalid MSISDN format (not E.164 international number)"
}
}
]
}

Bad request error response

Schema

    codeintegerrequired

    Error code

    messagestring

    Error description

    errorIdstring<uuid>required

    Unique id of error. You can use it as reference when sending enquiries to 8x8 support

    timestampstring<date-time>required

    Data and time of the error occurence

{
"code":1001,
"message":"Provided subAccountId doesn't belongs to your account",
"errorId":"91b106f0-c0da-4aba-a43a-7af9c5893a80",
"timestamp":"2017-04-19T02:31:19.4297387+00:00"
}
{
"code":1002,
"message":"Invalid MSISDN format (not E.164 international number)",
"errorId":"b4478860-b76c-e811-814e-022a35cc1c71",
"timestamp":"2018-08-04T09:25:40.9235752+00:00"
}

Request was not authenticated response

Schema

    codeintegerrequired

    Error code

    messagestring

    Error description

    errorIdstring<uuid>required

    Unique id of error. You can use it as reference when sending enquiries to 8x8 support

    timestampstring<date-time>required

    Data and time of the error occurence

{
"code":1001,
"message":"Provided subAccountId doesn't belongs to your account",
"errorId":"91b106f0-c0da-4aba-a43a-7af9c5893a80",
"timestamp":"2017-04-19T02:31:19.4297387+00:00"
}
{
"code":1200,
"message":"Request was not authenticated properly",
"errorId":"db9dced4-3534-4d86-9d18-6b448af0d621",
"timestamp":"2018-08-02T09:42:38.8988997+00:00"
}

Internal server error

Schema

    codeintegerrequired

    Error code

    messagestring

    Error description

    errorIdstring<uuid>required

    Unique id of error. You can use it as reference when sending enquiries to 8x8 support

    timestampstring<date-time>required

    Data and time of the error occurence

{
"code":1001,
"message":"Provided subAccountId doesn't belongs to your account",
"errorId":"91b106f0-c0da-4aba-a43a-7af9c5893a80",
"timestamp":"2017-04-19T02:31:19.4297387+00:00"
}
{
"code":2000,
"message":"Internal server error",
"errorId":"db9dced4-3534-4d86-9d18-6b448af0d621",
"timestamp":"2018-07-02T09:42:38.8988997+00:00"
}

Source: https://developer.8x8.com/connect/docs/survey-send-many · 8x8 CPaaS Developer Docs. Synced for support deflection.

Was this article helpful?
or
0 out of 0 found this helpful

0 Comments

Please sign in to leave a comment.

Didn't find what you were looking for?

Submit a request