Activity Feeds V3 is in closed alpha — do not use it in production (just yet).

Push Notifications

We suggest setting up push notifications using one of Stream’s client-side SDKs. However, if your use-case doesn’t allow for this, you can call Stream’s device management endpoints from your server-side integration as well. Stream API supports the following push providers: Firebase Cloud Messaging, Apple Push Notification (APN), Huawei Push and Xiaomi Push.

Configuring push providers

More information on how to configure push providers is coming soon.

Device management

Device management lets you register your push tokens to the Stream API, which is used to deliver push notifications.

Creating a device

ctx := context.Background()

resp, err := client.CreateDevice(ctx, &getstream.CreateDeviceRequest{
	Id:     "<push token>",
	UserId: "<user id>",
})
if err != nil {
	// handle error
}

Listing devices

If you want to list the devices that are registered to the current user, you should use the ListDevices method:

ctx := context.Background()

resp, err := client.ListDevices(ctx, &getstream.ListDevicesRequest{
	UserId: "<user id>",
})
if err != nil {
	// handle error
}

// Access the devices
devices := resp.Data.Devices

The device contains the following properties:

type Device struct {
	CreatedAt         time.Time `json:"created_at"`
	Id                string    `json:"id"`
	PushProvider      string    `json:"push_provider"`
	UserId            string    `json:"user_id"`
	Disabled          *bool     `json:"disabled,omitempty"`
	DisabledReason    *string   `json:"disabled_reason,omitempty"`
	PushProviderName  *string   `json:"push_provider_name,omitempty"`
	Voip              *bool     `json:"voip,omitempty"`
}

Removing devices

ctx := context.Background()

resp, err := client.DeleteDevice(ctx, &getstream.DeleteDeviceRequest{
	Id:     "<device id>",
	UserId: "<user id>",
})
if err != nil {
	// handle error
}
© Getstream.io, Inc. All Rights Reserved.