- TLC Home Home
- Discussions & Ideas Discussions & Ideas
- Product Guides Product Guides
- Knowledge Base Knowledge Base
- Developer Docs Developer Docs
- Education Education
- Blog Blog
- Support Desk Support Desk
How to configure an advanced Webhook - Send Custom Request action using Template Variables for Kony API
Submit an http request to Kony with a list of subscriber IDs and name & value pairs. Whole request body is a JSON message.
{ "messageRequest": { "appId": "IceMobile", "global": {}, "messages": { "message": { "content": { "priorityService": "false", "data": "Message Body", "mimeType": "text/plain" }, "overrideMessageId": 0, "startTimestamp": 0, "expiryTimestamp": 0, "subscribers": { "subscriber": [ { "ksid": "95784" }, { "ksid": "97899" } ] }, "platformSpecificProps": { "iphone": { "badge": 0, "customData": { "key": [ { "name": "trip_type", "content": "o" }, { "name": "o", "content": "LAX" }, { "name": "d", "content": "NRT" }, { "name": "dd", "content": "2016-01-09" }, { "name": "rd", "content": "2016-01-20" } ] } } }, "type": "PUSH" } } } }
Set to “POST”.
Set to PutsReq bucket URL.
Consult Kony API documentation for a URL. A PutsReq URL is adequate to demonstrate a general implementation here.
Select option “application/json”.
Select “Body” option and provide a template reference.
Name | Value |
---|---|
Body | {{json_template}} |
Set name and value pairs to be referenced and replaced in templates.
Name | Value | Note |
---|---|---|
subscribers.ksid | Kony Sub IDs | Set of Strings attribute |
customData.name | Kony Data Names | Set of Strings attribute |
customData.content | Kony Data Contents | Set of Strings attribute |
Variables are internally translated to JSON and made available to all templates.
{ "subscribers": [ { "ksid": "sub-id-1" }, { "ksid": "sub-id-2" } ] "customData": [ { "name": "name-1", "content": "Content A" }, { "name": "name-2", "content": "Content B" }, { "name": "name-3", "content": "Content C" } ] }
Name | Value |
---|---|
json_template |
{ "messageRequest": { "appId": "IceMobile", "global": {}, "messages": { "message": { "content": { "priorityService": "false", "data": "Message Body", "mimeType": "text/plain" }, "overrideMessageId": 0, "startTimestamp": 0, "expiryTimestamp": 0, "subscribers": { "subscriber": [ {{#subscribers}} { "ksid": "{{ksid}}" }{{#iter.hasNext}}, {{/iter.hasNext}} {{/subscribers}} ] }, "platformSpecificProps": { "iphone": { "badge": 0, "customData": { "key": [ {{#customData}} { "name": "{{name}}", "content": "{{content}}" }{{#iter.hasNext}}, {{/iter.hasNext}} {{/customData}} ] } } }, "type": "PUSH" } } } } |
Internally template get rendered (see below) and its content injected where referenced (i.e.: Body).
Name | Value |
---|---|
json_template |
{ "messageRequest": { "appId": "IceMobile", "global": {}, "messages": { "message": { "content": { "priorityService": "false", "data": "Message Body", "mimeType": "text/plain" }, "overrideMessageId": 0, "startTimestamp": 0, "expiryTimestamp": 0, "subscribers": { "subscriber": [ { "ksid": "sub-id-1" }, { "ksid": "sub-id-2" } ] }, "platformSpecificProps": { "iphone": { "badge": 0, "customData": { "key": [ { "name": "name-1", "content": "Content A" }, { "name": "name-2", "content": "Content B" }, { "name": "name-3", "content": "Content C" } ] } } }, "type": "PUSH" } } } } |
Copyright All Rights Reserved © 2008-2022