User Presence

You programmatically check the online status and current activity of users on your app.

GET/v1/{appId}/users/{userId}/sessions

{userId} is your internal unique identifier for the user.

Getting a user's online status

GET/v1/{appId}/users/{userId}/sessions
[
{
"isTyping": boolean,
"currentConversationId": string | null
},
...
]

If you create a TalkJS session on every page, which we recommend, then you may see multiple session objects in the response: one for the TalkJS background session, and one for each visible TalkJS UI (an Inbox, a Chatbox or a popup widget).

Examples

User 6789 is offline:

// request:
GET https://api.talkjs.com/v1/YOUR_APP_ID/users/6789/sessions
// response:
[]

User 6789 is logged into your site, but not looking at a TalkJS UI:

// request:
GET https://api.talkjs.com/v1/YOUR_APP_ID/users/6789/sessions
// response:
[
{
"isTyping": false,
"currentConversationId": null
}
]

User 6789 is logged into your site and looking at conversation 1234 in the Inbox, currently busy typing a message:

// request:
GET https://api.talkjs.com/v1/YOUR_APP_ID/users/6789/sessions
// response:
[
{
"isTyping": false,
"currentConversationId": null
},
{
"isTyping": true,
"currentConversationId": "1234"
}
]