Set User ID
Developers can set a unique identity ID for Agent users across different channels (e.g., website, APP, LiveChat). This user ID (UserId) allows for user identity association across channels, enabling cross-channel user identity merging, business queries via Tools, maintenance of user attributes, and chat records. Specific application scenarios are as follows:
- Tools: When the AI Agent calls Tools to make a request to the developer's business API, it will include the UserId in the Header to facilitate user identity recognition by the developer.
- User Attributes: Once the developer sets the UserId, user attribute information will be attributed to that UserId.
- Chat Logs: Once the developer sets the UserId, the chat logs between the user and the Agent will be attributed to that UserId.
- Event Callback: Once the developer sets the UserId, the event callback generated in the iframe/widget will report this information to GA4/webhook.
⚠️ The user ID (
UserId) should be the unique identity identifier of the user within the developer's business system. Through this UserId, business data information such as the user's VIP level, user tags, and user orders can be queried.
API Set User ID
When developers integrate Agent capabilities via API to provide services to users, they usually need to create a conversation ID (conversation_id) for different users as the basic carrier for providing AI services. The prerequisite for creating a conversation_id is that a user ID must be set first.
Request Method
POST
Endpoint
https://api.gptbots.ai/v1/conversation
Request Example
curl -X POST 'https://api.gptbots.ai/v1/conversation' \
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: application/json' \
-d '{
"user_id": "your_user_id"
}'
For detailed instructions on creating a conversation_id, see Create Conversation.
