Migrating
Guide on how to adopt new Anam features
Deprecate GET /session-token
Important Update: Declaring persona configuration on the client side is deprecated and has been removed in the latest version of the Anam SDK. You should follow the instructions below to migrate to the new POST /session-token endpoint and pass the persona config in the request body.
What This Means For You
If you currently use the GET /session-token endpoint, or use the POST /session-token endpoint with a personaConfig on the client side, you will need to update your code to pass your persona config in the request body. This means you will need to move your persona configuration from your client side to your server side.
The benefits of this change are:
- Allows for persona config to be defined entirely at runtime
- Increased security, don’t reveal your Anam config such as persona ID or system prompt to the client
- Improved performance, this is part of a wider initiative to improve connection start times
Implementation Recommendations
- Upgrade to the latest version of the Anam SDK.
- If you currently make a GET request to /session-token, please update this to a POST and pass the personaConfig in this request. This must still be from you server side config, so you may need to pass details from your client side config to your server if you are creating your system prompt dynamically.
- Update your client side to use the session token only
createClient(sessionToken)
. Optionally you can still pass in client options such asdisableInputAudio
to the client:createClient(sessionToken, { disableInputAudio: true })
.
For more information on creating sessions, see here.
Example migration
The old way:
The new way:
For more in depth examples of how to define your persona config at runtime see our full implementation example.