In addition to the Authentication payload, you may want to integrate other user session data from your application. This is done by specifying an exit program, which is a Node.js script that receives something like a session id and returns an object with custom session data from the application.
Client-side code can provide information to the agent via the data
parameter. The agent will pass this information along to the exit point. For example:
Code Block |
---|
|
profound.ai.startAgent({
agent: "my-assistant.agent.json",
data: () => ({
"sessionId": currentSessionId
})
}); |
The server-side exit point can process the information as follows:
Code Block |
---|
|
function sessionExitPoint(data) {
const sessionId = data.sessionId;
// logic to retrieve session data goes here
return sessionData;
}
exports.default = sessionExitPoint; |