You can also annotate custom values with the external_attributes JSON. By default we merge external attributes, keeping unset values, to deactivate merging the top level keywords set merge_external_attributes to false
The total JSON size of external_attributes must be below 8KB.
A session allows users to retrieve their past conversations.By default, botBrains enables session continuity within the same browser and all subdomains. This means a user that goes to your landing page on www.acme.com and then signs into app.acme.com will still be identified as the same user.You can opt-in to cross device session continuity by manually the user via the user.identify action in the SDK.
The user_01234567890 key here is what we call the external_id of a user. Two users with the same external_id will be able to reach each others conversations.
Not following these recommendations make the conversations of your users vulnerable to impersonation. botBrains does not take responsibility for misconfigured systems.
Since we allow you to explicitly set if users are the same or different and thus retrieve sensitive information such as past conversations, we need to be careful in choosing the external_id. You have two options:
User-Specific SecretRandomly generate an id, store with your user and sent to your frontend. Do not use or leak this anywhere.
Verified User ID (β Recommended)Possibly known ID that is added with a signature of a shared secret of your backend and the botBrains Platform.
You associate your user with an unique identifier (e. g. UUID) that should never be known by other users. User Ids are commonly leaked in your app supports Teams, Collaborates, Share Links and other features, thus your user_id is usually a bad choice.Insecure External Ids are:
Alternatively, we suggest you use user verification. User Verficiation works by signing the values you pass to the SDK on a backend server and passing it through your frontend into the Web SDK.The signature is the HMAC, that is the hash of your user identifier and a shared secret known to your backend servers and the botBrains platform.
We will share the verification secret with you on request, this is currently not expose through our platform
The Verification Secret must never be sent to the frontend. The hash must be computed on the backend and send to the frontend, which invokes the Web SDK.
Below you will find example code of the business logic your backend server needs to perform.
On the client, you then call user.identify with external_id_signature. Note that we expect the hex-encoded version of the resulting 32 bytes of hmac, totaling 64 characters.
You can also verify the email and phone of a user, using the same HMAC procedure shown above, just using the email and phone values instead of the user_id.