Javascript

Batch Methods

LAST EDIT Jul 27 2021

Batch Add Activities

Copied!

Multiple activities can be added with a single batch operation. This is very convenient when importing data to Stream.

Parameters

Copied!
nametypedescriptiondefaultoptional
activitieslistThe list of activities to be added (as specified in Adding Activities)-

Activity IDs

Copied!

The API will return a response with a list containing the activity ids.

TO field targeting is not permitted via this endpoint. Attempting to add activities with a 'to' property will result in an error response.
If you are importing your data for the first time, we suggest you create the follow-relationships after the activity import.

Batch Activity Add

Copied!

This method allows you to add a single activity to multiple feeds with one API request.

Batch Activity Add has a limit of 100 target feeds. Requests that exceed this limit will return an error.

Parameters

Copied!

name

type

description

feeds

list

The list of a feeds e.g. ['user:1', 'timeline:2']

activity

object

The activity object (see Feed endpoint for reference)

Activities added using this method are not propagated to followers. That is, any other Feeds that follow the Feed(s) listed in the API call will not receive the new Activity.
Even if real-time is enabled, for this endpoint it is disabled by default since it's mainly for backend processing which shouldn't create noise for users. If you want to enable it, please send a request to support with your app id.

Batch get Activities by ID

Copied!

Activities can be retrieved by IDs or foreign ID and time.

Combining ID and foreign ID + time parameters is not allowed.

Parameters

Copied!
nametypedescriptiondefaultoptional
idsstringThe comma-separated list of activity IDs to retrieve-
foreign_id_timeslistThe list of foreign_id and time values used to retrieve activities-
The number of activities that can be retrieved with a single request is limited to 100.

Batch Follow

Copied!

Stream's Follow Many functionality gives you a fast method to follow many feeds in one go. This is convenient when importing data or on-boarding new users.

Follow Many has a limit of 2,500 follows per request.

activity_copy_limit can be specified to copy specific number of activities. By default, it's 100 such that upon follow 100 activities from the followed feed will be seen in our feed.

Parameters

Copied!
The Batch Follow API does not return response data.

Batch Unfollow

Copied!

Unfollow Many enables you to unfollow many feeds in bulk. However, its implementation is heavy. That's why its usage restricted to Enterprise accounts. While unfollowing, history can be kept by keep_history. It's false by default. When unfollow is done, any activities that come from unfollowed feed will be removed but if the flag is set, then this history will remain.

The Batch Unfollow API does not return response data. An error is returned on wrong input.