Send a Single Prepared SMS
  • 1 Minute to read
  • Dark
    Light

Send a Single Prepared SMS

  • Dark
    Light

Article summary

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 Type

Definition

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.

ID

Contact (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' \  'https://your-engage-domain.com/api/rest/contact/get' \
{
 "type":"MOBILE",
 "value":"48505606707"
}
<soapenv:Envelope
    xmlns:soapenv="https://schemas.xmlsoap.org/soap/envelope/"
    xmlns:ecm="https://your-engage-domain.com/developer/ecmapi">
    <soapenv:Header/>
    <soapenv:Body>
        <ecm:contactGet>
            <identifier>
                <type>MOBILE</type>
                <value>48505606707</value>
            </identifier>
        </ecm:contactGet>
    </soapenv:Body>
</soapenv:Envelope>

Response

Description

200

From this request, you should receive a 200 response, with information about the contact. This includes information like their contactID.

400

If 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' \
  'https://your-engage-domain.com/api/rest/message/sendSingle?messageId=23541&recipientId=33457' \
{
"parameters":
[]
}
<soapenv:Envelope
    xmlns:soapenv="https://schemas.xmlsoap.org/soap/envelope/"
    xmlns:ecm="https://your-engage-domain.com/developer/ecmapi">
   <soapenv:Header/>
   <soapenv:Body>
      <ecm:messageSendSingle>
         <messageId>23541</messageId>
         <recipientId>33457</recipientId>
        <additionalContent>
         </additionalContent>
      </ecm:messageSendSingle>
   </soapenv:Body>
</soapenv:Envelope>

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

Implementation and Error Handling


Was this article helpful?