-
Notifications
You must be signed in to change notification settings - Fork 1
Home
This document provides required details to connect with ShoutOUT REST API for third parties. ShoutOUT API is CORS enabled. So you can use this for either front end or back end. But if you add SDK to front end, there is a possibility of expose your credentials.
- Api Key
Unique id assigned to the account. *
- Access Key
Access key to access the API. *
- Secret Key
Secret key to access the API. *
- Sender Id
Sender Id assigned to your account. *
- MSISDN
Standard name for a Mobile number. Mobile number should provide with the country code without ‘+’ sign and leading ‘0’ in the number. For an example, if number is 0778812345, then the format should be 94778812345 (Sri Lanka).
NOTE: The parameters indicated with ‘*’ will be provided with your account.
Initialize the ShoutOUT client as follow.
var shoutoutClient = apigClientFactory.newClient({
`accessKey: 'ACCESS_KEY',`
`secretKey: 'SECRET_KEY',`
`apiKey: 'API_KEY'
});
Create a contact under a group.
Request payload as follow. The properties 'msisdn' and 'group_ids' are required parameters. You can only define one group id at the moment. You can add any other arbitrary attributes to the contact as you wish.
var contact= {"msisdn":_mobileNumber_,"group_ids":[_groupId_],"name":_name_};
eg: var contact= {"msisdn":"94778812345","name":"Michael","product":"Water Pump","group_ids":["413"]};
Call to the method
shoutoutClient.contactsPost({}, contact)
`.then(function (result) {`
`//success result`
` }).catch(function (result) {`
`//failed result`
`});`
Response
201: success
You will get the same response as payload as Json string.
eg: {"group_ids":["413"],"msisdn":"94777123456","name":"Michael"} 400: Parse error
Can not parse the request. Check required parameters are present.
eg: {"message":"Invalid mobile number","code":2} 401: Authorization failed. Check your credentials.
500: Internal error. Try again later.
Send a message to given set of numbers. You can have up to 20 mobile numbers and minimum of 1 number in a single request.
var message={"source":_senderId_,"destinations":[_msisdn1,msisdn2,..,msisdn20_],"content":{"sms":_content_}}
eg: {"source":"ShoutOUT","destinations":["9477123456","9471432421"],"content":{"sms":"Welcome to ShoutOUT"}}
Response
201: Success
You will receive the object with remaining balance and other details.
eg: {"balance":47,"cost":1,"description":"Submit success","sent_on":"2015-10-20T11:43:39.278Z","status":"1001"}
400: Bad Request
401: Authorization Failed
500: Internal Error
eg: {"message":"Internal error. Try again later!","code":"6"}