In order to send a prepared SMS to a single recipient, you'll first have to make sure they exist in your system. Once you have their ID, you can send them the message which will also add them to the message's group. 

If you'd like, you can test with our Postman Collection here: Postman Collection

Prerequisites

Before you begin, make sure you have valid authorization credentials. Please see this page for more information.

The message needs to be set up ahead of time in Engage, as you need the messageID for this task. You will also need the contact's mobile number.

Procedure

In order to search for a contact or update their information, you will need to decide which identifier you'd like to use. We'll use their mobile number. If you already have the contact's recipientID (this is the same as user or contact ID), you can skip this step.

Contact Identifier TypeDefinition
EMAIL

The identifier is an email address.
MOBILE

The identifier is a mobile number.
APP_ALIAS

The identifier is a mobile app alias.
EXTERNAL

The identifier is a value generated by an external system.
IDContact (User) identifier

  1.  Use a POST request to check if the contact exists

    You'll need the contactID from this call to send them a message.

    'POST' \  'http://yourdomain.com/api/rest/contact/get' \
    {
     "type":"MOBILE",
     "value":"48505606707"
    }
    JS
    <soapenv:Envelope
        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:ecm="http://yourdomain.com/developer/ecmapi">
        <soapenv:Header/>
        <soapenv:Body>
            <ecm:contactGet>
                <identifier>
                    <type>MOBILE</type>
                    <value>48505606707</value>
                </identifier>
            </ecm:contactGet>
        </soapenv:Body>
    </soapenv:Envelope>
    JS

    Response

    Description

    200From this request, you should receive a 200 response, with information about the contact. This includes information like their contactID.
    400If the profile does not exist you will receive a 400 response. You can also double-check the number used in the call if you believe there is an existing user profile. 

  2. Use a POST request to send the message

    This method also automatically adds the user to the recipient group of the prepared message. While there is a space to include a TLS sender profile and attachment, these should only be used when sending emails and can therefore be left blank here.

    POST' \
      'http://your-domain.com/api/rest/message/sendSingle?messageId=23541&recipientId=33457' \
    {
    "parameters":
    []
    }
    JS
    <soapenv:Envelope
        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:ecm="http://yourdomain.com/developer/ecmapi">
       <soapenv:Header/>
       <soapenv:Body>
          <ecm:messageSendSingle>
             <messageId>23541</messageId>
             <recipientId>33457</recipientId>
            <additionalContent>
             </additionalContent>
          </ecm:messageSendSingle>
       </soapenv:Body>
    </soapenv:Envelope>
    JS

Conclusion

You should receive a 204 response, with no further information. This indicates the message has been sent. If there was a problem, you may receive a 400 response. 


Related Topics

Engage web service implementation and error handling