User presence
List online users
Lists online users.
You can programmatically check the online status and current activity of users on your app.
If you create a TalkJS session on every page—which we recommend—then TalkJS internally stores two sessions: one background session for each user, and one session for each active TalkJS chat UI widget.
By default, we don't return users with only a background session. You can change this behavior by passing the includeBackgroundSessions option.
post/v1/{appId}/presences
Request
- Base URLhttps://api.talkjs.com
- Auth
- HTTP bearer
- or HTTP bearer
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Path parameters
appIdstring required
Example:abcd1234
A unique identifier of your TalkJS app. You can find your app ID on the Settings page of your dashboard.
Request body
Example request
{
"includeBackgroundSessions": true,
"selectedConversationId": "0123456789",
"hasFocus": true,
"isTyping": true,
"userIds": [
"alice",
"sebastian"
]
}Response
Online users listed successfully.
Example response
{
"data": {
"alice": {
"status": "online",
"backgroundSessions": [
{
"custom": {
"priority": "high"
},
"selectedConversationId": "0123456789abcdef",
"isTyping": false,
"hasFocus": true,
"sessionId": "0123456789-0123456789-abcde-abcde"
}
],
"widgets": [
{
"custom": {
"priority": "high"
},
"selectedConversationId": "0123456789abcdef",
"isTyping": false,
"hasFocus": true,
"sessionId": "0123456789-0123456789-abcde-abcde"
}
]
},
"sebastian": {
"status": "online",
"backgroundSessions": [
{
"custom": {
"priority": "high"
},
"selectedConversationId": "0123456789abcdef",
"isTyping": false,
"hasFocus": true,
"sessionId": "0123456789-0123456789-abcde-abcde"
}
],
"widgets": [
{
"custom": {
"priority": "high"
},
"selectedConversationId": "0123456789abcdef",
"isTyping": false,
"hasFocus": false,
"sessionId": "0123456789-0123456789-abcde-abcde"
}
]
}
}
}Changes
No recorded changes to this operation across all 1 revision of this API.