Users

Get a user

Gets a specific user by their user ID. A user is a person or a group of people who uses your app.

For more on the concept of a user in TalkJS, see: Users.

get/v1/{appId}/users/{userId}

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

User fetched successfully.

idstring

A unique identifier of a user.

When setting a user id, consider using the same user ID as the one you use inside your own database.

createdAtinteger

Timestamp of when this message was sent, expressed as the number of milliseconds since the UNIX epoch (1970-01-01, 00:00:00 UTC).

namestring

Name of a user

rolestring nullable

A user's role. You can set up roles from the Roles page of your TalkJS dashboard.

You can vary many settings per user role, such as the content of their email or SMS notification, the look and feel of the UI, or forbidden words. Make sure the value of role corresponds exactly to a role name you set in the dashboard.

For more information on roles, see: Roles.

customobject

A custom property of a user. Custom properties are made available in the events sent to your code and in your email or SMS notification templates. For more on custom user properties, see: Custom user properties.

emailstring[]

An array of email addresses of a user.

If enabled, email addresses are used to send a user email notifications of messages they may have missed while they were offline.

photoUrlstring nullable

A URL to a profile image (avatar) of a user. The photo shows up to other users who are in conversation with this user.

localestring nullable

An IETF language tag that sets a language and date format for this user.

You can set a default locale for your entire app on the Settings page of your TalkJS dashboard.

phonestring[]

An array of phone numbers of a user in the E.164 international phone number format, without spaces.

If enabled, phone numbers are used to send a user SMS notifications for messages they may have missed while they were offline.

welcomeMessagestring nullable

An optional welcome text shown to another user at the start of a conversation.

availabilityTextstring nullable

An optional neutral text sent by this user at the start of a new conversation, rendered as a System Message.

availabilityText is deprecated in favor of conversation.welcomeMessages.

pushTokensobject

pushTokens is an object that has the keys in the format:

provider:TOKEN_ID

Where provider is either fcm for Android (Firebase Cloud Messaging), or apns for iOS (Apple Push Notification Service). And where TOKEN_ID is the token ID for your push notification service.

To register a device for push notifications, set the value to the string true.

To deregister a device for push notifications on all previously registered devices, set the value to null.

For more on push tokens, see: Mobile push notifications.

Example response

{
  "id": "0123456789abc",
  "createdAt": 1525249255419,
  "name": "Alice",
  "role": "admin",
  "custom": {
    "country": "Bahrain"
  },
  "photoUrl": "https://talkjs.com/images/avatar-1.jpg",
  "locale": "ar",
  "welcomeMessage": "Hi there, how are you? :-)",
  "availabilityText": "We're usually online during office hours",
  "pushTokens": {
    "fcm:TOKEN_ID": true
  }
}

Changes

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