Parameterized message tutorial continued
Connect your data
- Connect your own database.
For the sake of simplicity, and because data is kept in many forms, we will just define a few variables in our upcoming send file. But, we'll use this page to explain a few things.
- Define your custom parameters for each
parameter_key
.Notice that our
parameters
are defined within thebody
of the request.You would otherwise define variables that connect back to your exernal database and then stringify them within the parameters.
Note:
There is no need to copy this sample. It's for reference as we explain more about parameters.
parameters: {
// Each of these is a parameter_key (as seen in the SMS API reference).
firstName: {
// We have directly defined a phone number,
// name and team for the sake of testing.
'14051234567': 'Aaron',
default: 'Buddy'
},
team: {
'14051234567': 'The Cyber Nerds',
default: 'you'
}
A few key points about parameters
- The
msisdn
(phone number) is the connecting factor for all data you'd like to include in your message. - The phone number (aka
msisdn
) must be valid and you must include the country code. - You'll notice you have a
+
in front your Sinch virutal numbers in the Sinch Customer Dashboard. The API will work with or without the leading+
. - It is good practice to define a
default
for each parameter so that there is always an option for null values in your database. - For more parameter-specific info, check out the API Reference