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

Import Files

Imports are not entirely supported on V3. This page is a work in progress.

If you’ve just started using Stream, you might want to import data from your old infrastructure. Instead of using the APIs and creating your own import scripts, you can make use of our import feature.

The Process

The steps for importing data into your app are as follows:

Install the CLI

brew tap GetStream/stream-cli https://github.com/GetStream/stream-cli
brew install stream-cli

Setup your app

stream-cli config new
stream-cli feeds import-validate myfile.json
stream-cli feeds import --apikey 123 myfile.json
stream-cli feeds import-status

Users

Users are shared with chat and video. So if you already use those products you typically don’t need to import users. The structure for importing users is shown below:

var activities = new List<ActivityRequest>
{
    new ActivityRequest
    {
        Type = "post",
        Text = "Batch activity 1",
        UserID = _testUserId
    },
    new ActivityRequest
    {
        Type = "post",
        Text = "Batch activity 2",
        UserID = _testUserId
    }
};

var response = await _feedsV3Client.UpsertActivitiesAsync(
    new UpsertActivitiesRequest { Activities = activities }
);

Feeds

This is how you can import activities to a feed.

var activities = new List<ActivityRequest>
{
    new ActivityRequest
    {
        Type = "post",
        Text = "Batch activity 1",
        UserID = _testUserId
    },
    new ActivityRequest
    {
        Type = "post",
        Text = "Batch activity 2",
        UserID = _testUserId
    }
};

var response = await _feedsV3Client.UpsertActivitiesAsync(
    new UpsertActivitiesRequest { Activities = activities }
);

See the feeds docs for all supported fields

Activities

This is how you can import activities to a feed.

var activities = new List<ActivityRequest>
{
    new ActivityRequest
    {
        Type = "post",
        Text = "Batch activity 1",
        UserID = _testUserId
    },
    new ActivityRequest
    {
        Type = "post",
        Text = "Batch activity 2",
        UserID = _testUserId
    }
};

var response = await _feedsV3Client.UpsertActivitiesAsync(
    new UpsertActivitiesRequest { Activities = activities }
);

See the activity docs for all supported fields

Follows

For follows specify the import in the following structure:

var activities = new List<ActivityRequest>
{
    new ActivityRequest
    {
        Type = "post",
        Text = "Batch activity 1",
        UserID = _testUserId
    },
    new ActivityRequest
    {
        Type = "post",
        Text = "Batch activity 2",
        UserID = _testUserId
    }
};

var response = await _feedsV3Client.UpsertActivitiesAsync(
    new UpsertActivitiesRequest { Activities = activities }
);

Members

For follows specify the import in the following structure:

var activities = new List<ActivityRequest>
{
    new ActivityRequest
    {
        Type = "post",
        Text = "Batch activity 1",
        UserID = _testUserId
    },
    new ActivityRequest
    {
        Type = "post",
        Text = "Batch activity 2",
        UserID = _testUserId
    }
};

var response = await _feedsV3Client.UpsertActivitiesAsync(
    new UpsertActivitiesRequest { Activities = activities }
);

Comments

For reactions specify the import in the following structure:

var activities = new List<ActivityRequest>
{
    new ActivityRequest
    {
        Type = "post",
        Text = "Batch activity 1",
        UserID = _testUserId
    },
    new ActivityRequest
    {
        Type = "post",
        Text = "Batch activity 2",
        UserID = _testUserId
    }
};

var response = await _feedsV3Client.UpsertActivitiesAsync(
    new UpsertActivitiesRequest { Activities = activities }
);

Specify either the comment or the activity id

Reactions

For reactions specify the import in the following structure:

var activities = new List<ActivityRequest>
{
    new ActivityRequest
    {
        Type = "post",
        Text = "Batch activity 1",
        UserID = _testUserId
    },
    new ActivityRequest
    {
        Type = "post",
        Text = "Batch activity 2",
        UserID = _testUserId
    }
};

var response = await _feedsV3Client.UpsertActivitiesAsync(
    new UpsertActivitiesRequest { Activities = activities }
);

Specify either the comment or the activity id

© Getstream.io, Inc. All Rights Reserved.