Sending a Single Prepared Email
  • 1 Minute to read
  • Dark
    Light

Sending a Single Prepared Email

  • Dark
    Light

Article summary

In order to send a prepared message 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 email.

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 email. 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

'POST' \  'https://your-engage-domain.com/api/rest/contact/get' \
{
  "type": "EMAIL",
  "value": "j.mcexample@example.com"
}'
<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>EMAIL</type>
                <value>j.mcexample@example.com</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 email used in the call if you believe there is an existing user profile. 

2. Use a POST request to send the prepared message

This method also automatically adds the user to the recipient group of the prepared message. You can include a TLS sender profile and attachments encoded using base64encode.org.

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?