Bixby Developer Center

References

payload-mapper

optionalvalue required

Enables you to send a more complex app-launch payload by invoking a local JavaScript function that maps the result-view bindings and a context object into an opaque JSON string that satisfies the client's payload format requirements.

This is an example of using payload-mapper:

result-view {
match: MyBool (this) {
from-output: MyAction (action)
}

app-launch {
payload-mapper (lib/payload-mappers.js::myMapper)

requires { // optional
app-id (MY_APP_ID) // optional
app-min-version (12345) // optional
app-store-url (...) // optional
}
}
}

This would be the corresponding lib/payload-mappers.js file:

export function myMapper(input) {
const { $bindings, $appLaunchContext } = input

return {
valueBoundToThis: $bindings.this,
valueBoundToActionDotX: $bindings.action.x,
mapperContext: $appLaunchContext,
}
}

The action MyAction, used in the from-output in the result-view's match pattern, is defined as follows:

action (MyAction) {
type (Search)
collect {
input (x) {
type (viv.core.Integer)
min (Required) max (One)
}
}
output (MyBool)
}

The $appLaunchContext variable, from lib/payload-mapper.js, contains the $vivContext.deviceModel property.

Caution

Your payload-mapper is not allowed to specify any dangerous permissions, such as accessing the user's contacts or calendars. If your capsule needs this level of access, consider using an appropriate Bixby library capsule.