User presence

List sessions for a user

Lists all sessions for a specific user.

If you create a TalkJS session on every page, then a user can have multiple session objects: one for the TalkJS background session, and one for each TalkJS UI that's in focus.

Examples

User alice is offline:

// request:
GET https://api.talkjs.com/v1/YOUR_APP_ID/users/alice/sessions

// response:
[]

User alice is logged into your site, but doesn't have a TalkJS UI in focus:

// request:
GET https://api.talkjs.com/v1/YOUR_APP_ID/users/alice/sessions

// response:
[
  {
    "isTyping": false,
    "currentConversationId": null
  }
]

User alice is logged into your site, has a TalkJS UI in focus and is currently typing a message in conversation 1234:

// request:
GET https://api.talkjs.com/v1/YOUR_APP_ID/users/alice/sessions

// response:
[
  {
    "isTyping": false,
    "currentConversationId": null
  },
  {
    "isTyping": true,
    "currentConversationId": "1234"
  }
]
get/v1/{appId}/users/{userId}/sessions

Request

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.

userIdstring required
Example:alice

A unique identifier of a user.

Response

Sessions for a user listed successfully.

isTypingboolean

Indicates whether the user is currently typing a message in this session.

currentConversationIdstring nullable

A unique identifier of a conversation.

Example response

[
  {
    "isTyping": true,
    "currentConversationId": "0123456789"
  }
]

Changes

No recorded changes to this operation across all 1 revision of this API.