createAppShortcut JS API
Use Case
A user can now add your Mini App icon to their phone screen for quick access. With just a click, the user can access your Mini App seamlessly, without even having to open the Paytm App
You can also prompt users to create an App shortcut, and include this in your post order communication, or any other point in your flow.
Request Attributes
PARAMETER | DESCRIPTION |
---|---|
uniqueId |
A string literal, which represents the shortcut |
shortLabel |
A concise phrase that describes the shortcut's purpose. When possible, limit the length of the short description" of a shortcut to 10 characters |
longLabel string |
An extended phrase that describes the shortcut's purpose. If there's enough space, the launcher displays this value instead of android:shortcutShortLabel. When possible, limit the length of the "long description" of a shortcut to 25 characters. Example: Decathlon |
disabledMessage string |
The message that appears in a supported launcher when the user attempts to launch a disabled shortcut. The message should explain to the user why the shortcut is now disabled Example: disabled |
deeplink string |
The action that the system launches when the user selects the shortcut. In this case deeplink denotes that respective mini app will be launched Example: paytmmp://mini-app?aId=ab&data=cd |
image Base64 or String(https url) |
The bitmap or adaptive icon that the launcher uses when displaying the shortcut to the user Example: https://developerminiapp.paytm.com/miniapps/icons/zbc-logo-icon_2021-01-28T18:56:58.266.png |
Response Attributes
Success:
Note: Response will come as JSON with key data.
PARAMETER | DESCRIPTION |
---|---|
success | shortcut widget shown success Example: true |
Error Codes:
CODE | DESCRIPTION |
---|---|
2 | When any of inputs is empty or null |
3 | When bitmap is unable to fetch or load |
4 | When version is below Oreo |
REQUEST
RESPONSE
JAVASCRIPT
JSBridge.call('createAppShortcut', {
uniqueId: "unique_id5",
shortLabel: "Decathalon",
longLabel: "Decathalon",
deeplink: "paytmmp://mini-app?aId=abs&data=xyz=",
disabledMessage: "disabled",
image: "https://map-cma-images-production.s3-ap-south-1.amazonaws.com/en-creatives/1572354072900_1551873574914livetrain.png"
},
function (result) {
console.log(JSON.stringify(result));
});