SmartThings SDK Subscribing to Devices Dynamically

DynamoDB is used only for the contextStore.
You can use any kind of persistent storage you want and save the object with the needed information to pass it to the withContext function of the SDK.
If you had the values in an object called localStore, then you would have to send this:

const ctx = await apiApp.withContext({
    installedAppId: localStore.installedAppId,
    locationId: localStore.locationId,
    authToken: localStore.authToken,
    refreshToken: localStore.refreshToken})

Or, as in this example, you could save those values in a server session:

2 Likes