URL |
http://<IAM_root_url>/oauth/token |
Method |
POST |
Header Parameters |
Content-Type: application/x-www-form-urlencoded |
Auth Header |
HTTP Basic auth header client_id : XXXXXX client_secret : XXXXX |
Request Body |
grant_type:client_credentials |
Response Body |
{ "access_token": string, "token_type": bearer, "expires_in": integer, "scope": "READ WRITE", "jti": string } |
Send Message
URL |
http://<MHNG_root_url>/api/send |
Method |
POST |
Header Parameters |
Content-Type: Application/JSON Authorization : bearer <token> |
Request Body |
{ "campaignId": string "msgContent": { "text": string, "link": string(url), "button": string, "image": string(url) }, "contacts": [{ "mobile": string, "placeHolders": object }] } |
Response Body |
{ "status": boolean, "code": integer } |
URL |
http://<MHNG_root_url>/api/create |
Method |
POST |
Header Parameters |
Content-Type: Application/JSON Authorization : bearer <token> |
Request Body |
{ "campaignName": "Test2020004", "accountId": "Acc_msg", "isAllChannelSelected": false, "messageType": 1, "content": { "message": "Welcome to MessageHub" }, "channels": [ { "type": "viber", "id": "1595ddd778" }, { "type": "sms", "id": "StarFriends" }, { "type": "whatsapp", "id": "StarFriends" } ] } |
Response Body |
"status": true, "code": 200, "data": { "campaign": "5fb5f8b915877d00182965b4" } } |
Validations |
accountId : msg_acc -> The user should have the permission to create campaign for “Msg_Acc” isAllChannelSelected : true -> Message send all the added channels. isAllChannelSelected : false -> The message should send channel order messageType : 1 ( TRANSACTIONAL ) -> “content” should contain "message" -> “content” should not contain "link", "button", "image" messageType : 2 ( PROMOTIONAL ) -> “content” should contain "message" -> whatsapp cannot be selected to promotional messages -> If “channel” contain “viber” then “content” should contain "link", "button", "image" -> "link" and "image" should be link URL Channels : [ ] -> The account have the same ids of the channels respectively -> The channel types are case sensitive ( sms, viber, whatsapp ) |
URL |
http://<MHNG_root_url>/api/send |
Method |
POST |
Header Parameters |
Content-Type: Application/JSON Authorization : bearer <token> |
Request Body |
{ "campaignId": "5fabbe5b7e54470018cdc19d", "msgContent": { "text": "Sample Text", "link": "https://staging-ui.messagehub.lk/", "button": "Click Me", "image": "testurl" }, "contacts": [{ "mobile": "07XXXXXXXX", "placeHolders": {}},{ "mobile": "07XXXXXXXX", "placeHolders": {}}] } |
Response Body |
{ "status": boolean, "code": integer } |
URL |
http://<MHNG_root_url>/api/send |
Method |
POST |
Header Parameters |
Content-Type: Application/JSON Authorization : bearer <token> |
Request Body |
{ "campaignId": "5fabbe5b7e54470018cdc19d", "msgContent": { "text": "${Message}", "link": "https://staging-ui.messagehub.lk/", "button": "Click Me", "image": "testurl" }, "contacts": [{ "mobile": "07XXXXXXXX", "placeHolders": {"Message":"Sample Text 1"}},{ "mobile": "07XXXXXXXX", "placeHolders": {"Message":"Sample Text 2"}}] } |
Response Body |
{ "status": boolean, "code": integer } |