Parameterized message tutorial continued

Connect your data

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

  2. Define your custom parameters for each parameter_key.Notice that our parameters are defined within the body 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.

Copy
Copied
        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
Go back
We'd love to hear from you!
Rate this content:
Still have a question?
 
Ask the community.