brew tap GetStream/stream-cli https://github.com/GetStream/stream-cli
brew install stream-cli
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
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:
{
"users": [
{
"id": "myuserid",
"role": "user",
"custom": {}
}
]
}
Feeds
This is how you can import activities to a feed.
{
"feeds": [
{
"id": "myid",
"group": "post",
"name": "myuserid",
"description": ["feed:123"],
"visibility": "",
"custom": {}
}
]
}
See the feeds docs for all supported fields
Activities
This is how you can import activities to a feed.
{
"activities": [
{
"id": "myid",
"type": "post",
"user_id": "myuserid",
"feed_ids": ["feed:123"],
"text": "hi",
"attachments": [],
"visibility": "public",
"visibility_tag": "premium",
"custom": {}
}
]
}
See the activity docs for all supported fields
Follows
For follows specify the import in the following structure:
{
"follows": [
{
"source": "feed:123",
"target": "feed:222",
"custom": {},
"push_preference": "none"
}
]
}
Members
For follows specify the import in the following structure:
{
"members": [
{
"user_id": "user:123",
"feed": "feed:222",
"custom": {},
"role": ""
}
]
}
Comments
For reactions specify the import in the following structure:
{
"comments": [
{
"object_id": "123",
"object_type": "456",
"comment": "buy a gaming chair",
"attachments": [],
"mentioned_user_ids": ["user:222"],
"parent_id": null,
"custom": {}
}
]
}
Specify either the comment or the activity id
Reactions
For reactions specify the import in the following structure:
{
"reactions": [
{
"activity_id": "123",
"comment_id": "456",
"type": "like",
"user_id": "222",
"custom": {}
}
]
}
Specify either the comment or the activity id