Web SDK (24.3.0-beta1)
Introduction
This guide describes features currently in beta release. For a full guide of the latest stable version, see the Web SDK guide.
Releases
The latest beta release is 24.3.0-beta1.
The current stable release is 24.2.1.
Metadata pass-through
Any metadata sent from an API request can now be accessed from within the SDK using the SDK Event Observer, once enabled in the Workbench
info
Currently the metadata is only returned in the card-displayed event.
An example body in an API request to an Action Flow trigger endpoint might look like:
{
"flows": [
{
"payload": {
"metadata": {
"account" : "123445",
"fruit" : "apple"
}
},
"target": {
"type": "user",
"targetUserIds": "user-123"
}
}
]
}
To retrieve the metadata just capture the card-displayed event in an SDK Event Observer, such as:
AtomicSDK.observeSDKEvents(event => {
if (event.eventName === "card-displayed") {
console.log(JSON.stringify(event));
}
});
The json returned in the event data will take the following shape:
{
"id": "043195e2-8b1d-40b2-b4f2-12a70bd1467e",
"endUserId": "user-123",
"timestamp": "2024-08-27T23:13:18.587Z",
"properties": {
"account": "123445",
"fruit": "apple"
},
"eventContext": {
"userLocalTimestamp": "2024-08-28T11:13:18.587+12:00"
},
"analyticsEvent": "card-displayed",
"hostContext": {},
"sdkContext": {
"containerId": "my-container"
},
"streamContext": {
"streamLength": 0,
"streamLengthVisible": 1,
"cardPositionInStream": 1
},
"cardContext": {
"cardInstanceId": "286c3fe4-a0ad-5879-a585-9736de8e2cdb",
"cardInstanceStatus": "active",
"cardViewState": "topview",
"cardPresentation": "individual"
},
"eventName": "card-displayed"
}
The metadata is included in the properties object:
"properties": {
"account": "123445",
"fruit": "apple"
},