Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

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:

profound.ai.startAgent({
  agent: "my-assistant.agent.json",
  data: () => ({
    "sessionId": currentSessionId
  })
});

The server-side exit point can process the information as follows:

function sessionExitPoint(data) {
  const sessionId = data.sessionId;
  // logic to retrieve session data goes here
  return sessionData;
}

exports.default = sessionExitPoint;
  • No labels