Registering devices

Once your app has enabled push notifications, use the APIs to register user devices such as iPhones and Android phones.

Each user has a limit of 25 unique devices. Once this limit is reached, the oldest device will be removed and replaced by the new device.

Device Parameters

NameTypeDescriptionDefaultOptional
idstringThe device ID (push token provided by the push provider)-
user_idstringThe user ID for this device-
push_providerstringThe push provider for this device: APN, Firebase, Huawei or Xiaomi-
disabledbooleanSet if the device is disabledfalse
disabled_reasonstringExplanation if the device is disabled-
push_provider_namestringThe push provider name for multi-bundle configurations-

Register a Device

Registering a device associates it with a user and tells the push provider to deliver notifications to the device.

Register the user's device for push notifications once your user is successfully connected.

Multi-bundle configurations require that you specify a push_provider_name when registering a device that corresponds to the name of the push configuration that you've set up in the dashboard or via the API.

await client.createDevice({
  id: "<push token>",
  push_provider: "apn",
  push_provider_name: "production-ios",
  user_id: "user_id",
});

Registering from the chat client SDKs

Registering a device associates it with a user and tells the push provider to send new message notifications to the device.

Register the user's device for remote push notifications once your user is successfully connected to Chat.

Multi-bundle configurations require that you specify a push_provider_name when registering a device that corresponds to the name of the push configuration that you've set up in the dashboard or via the API.

const id = "2ffca4ad6599adc9b5202d15a5286d33c19547d472cd09de44219cda5ac30207";
const push_provider = "apn";
const user_id = "Taquito";

await client.addDevice(id, push_provider, user_id);

// if multi providers
await client.addDevice(id, push_provider, user_id, push_provider_name);

Registering from the feeds client SDKs

Register a device to associate it with a user and enable push notifications for activity updates.

Register the user's device for push notifications once your user is successfully connected to Activity Feeds.

Multi-bundle configurations require that you specify a push_provider_name when registering a device that corresponds to the name of the push configuration you've set up in the dashboard.

Multi-Bundle Device Registration

When using multi-bundle configurations, specify the provider name:

await client.createDevice({
  id: "<push token>",
  push_provider: "apn",
  push_provider_name: "production-ios",
});

List Devices

Provides a list of all devices associated with a user.

const devices = await client.listDevices({ user_id: "<user_id>" });

Listing from the chat client SDKs

Provides a list of all devices associated with a user.

const user_id = "Taquito";

await chatClient.getDevices(user_id);

Listing from the feeds client SDKs

Get a list of all devices associated with a user.

const devices = await client.listDevices();

The device object contains the following properties:

{
  created_at: Date,
  id: string,
  push_provider: string,
  user_id: string,
  disabled?: boolean,
  disabled_reason?: string,
  push_provider_name?: string,
  voip?: boolean
}

Remove a Device

Removing a device stops further push notifications to it.

await client.deleteDevice({
  id: "<device id>",
});

Removing from the chat client SDKs

Unregistering a device removes the device from the user and stops further new message notifications.

const id = "2ffca4ad6599adc9b5202d15a5286d33c19547d472cd09de44219cda5ac30207";
const user_id = "Taquito";

await chatClient.removeDevice(id, user_id);

Removing from the feeds client SDKs

Remove a device to stop push notifications for that device.

await client.deleteDevice({
  id: "<device id>",
});

Troubleshooting Device Registration

If device registration isn't working:

  1. Check your push configuration in the Stream Dashboard
  2. Verify your device token is valid and current
  3. Ensure proper permissions are granted for notifications
  4. Check the push logs in the Stream Dashboard for error messages
  5. Test with different devices to isolate the issue

For more detailed troubleshooting, check the Activity Feeds logs and error responses from the API.