View Categories

Business Messenger SMS – SDK

7 minutes of reading

Prerequisites

To proceed with the integration of SMS Form SDK to your HTTPS web site you must meet the following conditions:

  • Locate your Form configuration from SMS.es Business Messenger Application
  • Download or use SMS Form SDK

1. Introduction #

SMS Form SDK is a javascript library that provides a subscription mechanism for SMS messages for your website.

After a visitor subscribes you will be able to send him SMS messages using standard Business Messenger campaigns.

The SDK can be used directly from javascript so that you can build your own custom subscription forms and collect some other information to be populated per contact in Business Messenger Contact Manager.

2. Setup #

The Business Messenger App Account #

It is implied that the user has the Business Messenger app account and can access it.

The Business Messenger App Web Form #

In the Business Messenger App go to the Web Services > Web Forms section, create a Web Form, and find your configuration in the Detailed View for the form (click the view icon from the grid last column). You will need the presented SDK Parameters later in configuring the SDK.

3. Integration #

Initialize SDK #

Include the SDK script in your page:

Initialize the SDK:

Set configuration and SDK just before the end of </body> tag

Note: A domain is presented with placeholders as https://api{separator}{platform_domain}, where {separator} can be a dot (.) or a hyphen (-). Please, replace it with your actual platform domain name.

Google reCaptcha #

reCAPTCHA protects against spam and other types of automated abuse.
Google reCaptcha is to be implemented by the developer who is implementing this SDK.
reCaptcha sitekey that is needed for reCaptcha initializing, can be found in the Business Messenger app, the “Web Services” > “Web Forms” section, under the Form Detailed View (click the view icon from the grid for the Form).

More info about implementing Google reCaptcha please find on Google Guides pages.

4. Configuration SDK Properties #

PropertyTypeParamsDescription
initFormfunctionObjectKeyTypeDescriptionRequiredurlstringDefines Form and API URL.YesParameters are obtained in the Business Messenger app after creating SMS Web Form, under form view from the grid.
Usage #

After SDK is initialized we can now use it to subscribe or unsubscribe users.
Subscribing or unsubscribing is a two-step process. After submitting the form, “code” is sent to users’ mobile number via SMS. That code must be sent in the second step.

First step example:

After the first step is successful, we need to send code that the user received on his mobile phone via SMS message.

Second step example:

PropertyTypeParams
submitFormfunctionObjectKeyTypeValuesDescriptionRequiredidentifierstringMobile phone number of a user that is subscribing/unsubscribing in international formatYesoption_uuidsstringComa separated array of option UUIDs witch users selected to subscribe/unsubscribe to/from.NorecaptchastringReCaptcha code. ReCaptcha is implemented by the form using SDKYestypestringin
outDefines if the form is used to subscribe (in) or unsubscribe (out) the userYes
submitCodefunctionObjectIf the form is used to unsubscribe the user (“type”: “out”), then additional user data will not be saved so there is no need to send them.
If additional user data is sent it will be ignored by API.KeyTypeValuesDescriptionRequiredcodestringCode that the user received on his mobile phone. The code must be obtained from the user and submitted so that we know it is really him who is subscribing.Yesfirst_namestringFirst NameNolast_namestringLast NameNonick_namestringNick NameNosecond_namestringSecond NameNogenderstringmale
femaleGender
Female -or- MaleNobirthdaystringBirthday Format: 2018-01-03NosalutationstringSalutationNofaxstringFaxNolanguagestring (lowercase)https://en.wikipedia.org/wiki/List_of_ISO_639-1_codesLanguage Example: ‘en’ for EnglishNonationalitystring (uppercase)https://en.wikipedia.org/wiki/ISO_3166-1Nationality Example: “GB” for United KingdomNomobilestringMobile Example: +41 78 123 45 67NophonestringPhone Example: +41 78 123 45 67NotitlestringTitleNozipstringZipNoaddressstringAddressNocitystringCityNoregionstringRegionNocountrystring (uppercase)https://en.wikipedia.org/wiki/ISO_3166-1country Example: “GB” for the United KingdomNob_addressstringBusiness addressNob_citystringBusiness cityNob_companystringCompany nameNob_countrystring (uppercase)https://en.wikipedia.org/wiki/ISO_3166-1Bussiness Country example: ‘DE’ for GermanNob_departmentstringBusiness DepartmentNob_emailstringBusiness EmailNob_job_titlestringJob TitleNob_mobilestringBusiness Mobile Example: +41 78 123 45 67Nob_phonestringBusiness Phone Example: +41 78 123 45 67Nob_reception_codestringBussiness Reception codeNob_regionstringBusiness RegionNob_zipstringBusiness ZipNo

5. Example #

Here is a working example of SDK in action. In order for this example to work all parameters should be replaced with real ones and run in a localhost environment (e.g. http://localhost:3000/).

Note that the port number can be changed.