SMS
Provider
NotifyBC depends on underlying SMS service providers to deliver SMS messages. The supported service providers are
- Twilio (default)
- Swift
- Vonage (formerly Nexmo)
Only one service provider can be chosen per installation. To change service provider, add following config to file src/config.local.js
module.exports = {
sms: {
provider: 'swift',
},
};
Provider Settings
Provider specific settings are defined in config sms.providerSettings. You should have an account with the chosen service provider before proceeding.
Twilio
Add sms.providerSettings.twilio config object to file src/config.local.js
module.exports = {
sms: {
providerSettings: {
twilio: {
accountSid: '<AccountSid>',
authToken: '<AuthToken>',
fromNumber: '<FromNumber>',
},
},
},
};
Obtain <AccountSid>, <AuthToken> and <FromNumber> from your Twilio account.
Swift
Add sms.providerSettings.swift config object to file src/config.local.js
module.exports = {
sms: {
providerSettings: {
swift: {
accountKey: '<accountKey>',
},
},
},
};
Obtain <accountKey> from your Swift account.
Unsubscription by replying a keyword
With Swift short code, sms user can unsubscribe by replying to a sms message with a keyword. The keyword must be pre-registered with Swift.
To enable this feature,
Generate a random string, hereafter referred to as <randomly-generated-string>
Add it to sms.providerSettings.swift.notifyBCSwiftKey in file src/config.local.js
module.exports = { sms: { providerSettings: { swift: { notifyBCSwiftKey: '<randomly-generated-string>', }, }, }, };
Go to Swift web admin console, click Number Management tab
Click Launch button next to Manage Short Code Keywords
Click Features button next to the registered keyword(s). A keyword may have multiple entries. In such case do this for each entry.
Click Redirect To Webpage tab in the popup window
Enter following information in the tab
- set URL to <NotifyBCHttpHost>/api/subscriptions/swift, where <NotifyBCHttpHost> is NotifyBC HTTP host name and should be the same as HTTP Host config
- set Method to POST
- set Custom Parameter 1 Name to notifyBCSwiftKey
- set Custom Parameter 1 Value to <randomly-generated-string>
Click Save Changes button and then Done
Vonage
Add sms.providerSettings.vonage config object to file src/config.local.js
module.exports = {
sms: {
providerSettings: {
vonage: {
from: '<yourVonagePhoneNumber>',
apiKey: '<yourVonageApiKey>',
apiSecret: '<yourVonageApiSecret>',
},
},
},
};
Obtain <yourVonagePhoneNumber>, <yourVonageApiKey> and <yourVonageApiSecret> from your Vonage account.
Throttle
All supported SMS service providers impose request rate limit. NotifyBC by default throttles request rate to 4/sec. To adjust the rate, create following config in file src/config.local.js
module.exports = {
sms: {
throttle: {
max: 4,
duration: 1000,
},
},
};
where
- max - max numbers of requests per duration. Default to 4.
- duration - time span in ms. Default to 1000.
To disable throttle, set sms.throttle.enabled to false in file /src/config.local.js
module.exports = {
sms: {
throttle: {
enabled: false,
},
},
};