When you want to send a SMS or E-mail campaign, you will have to write the SMS or E-mail body. The body will be send to all recipients. With our service you can personalise the bodies. In this tutorial we will explain how you can do that.
When you use variables, the length of the body might vary. Especially for SMS there is a risk you will exceed the maximum length. In that case the SMS will be rejected. For more information on the maximum length of a SMS, please check our tutorial ‘How to send a concatenated long SMS‘.
For e-mail campaigns you can use variables not only in the body of the email, but also in the subject.
When you are composing your campaign and you enter the body, you can press the `VARIABLES` button. This will popup a form where you see a list of all variables. By pressing the `Insert` button, the variable will be inserted at the location of the cursor.
When you have inserted a variable, you will see something like this:
When you look at the Address Book API you will see the properties of a contact. There are 2 groups of properties of a contact; attributes and channels. Within the attributes group you see for example `firstName`. So the above example will fill in the first name of a contact at the place of the variable.
Example of a private mobile number in the body:
In case the property of your contact is empty, e.g. the first name is not filled in, the variable will be replaced with an empty string. This might not always be what you want, so you can specify a default value in case the property is empty. When the property is empty, the variable will be replaced with the default value. You can specify the default value by adding a `|` and then the default value behind the property. So like this:
A full example would look like this:
Body composed with variables
Dear %attributes.firstName|customer%, We have sent this message to your mobile number %channels.mobile.private%. Kind regards, Silverstreet
Result first name filled in
Dear John, We have sent this message to your mobile number 31612345678. Kind regards, Silverstreet
Result first name not filled in
Dear customer, We have sent this message to your mobile number 31612345678. Kind regards, Silverstreet