📃 Use cases

App configuration

You can handle multiple Chat apps with the CLI.

List your configurations:

$ stream-cli config list

           Name     Access Key         Secret Key          URL
           ----     ----------         ----------          ---
(default)  test     kujk3ms96pby       **************323m
           prod     v5hg34n2m2nv       **************76as
           staging  nrnn2rmnb52u       **************242b

The default app is used when no --app flag is provided to the command.

Add a new configuration:

$ stream-cli config new
? What is the name of your app? (eg. prod, staging, testing) prod
? What is your access key? v5hg34n2m2nv
? What is your access secret key? ***********************************************************
? (optional) Which base URL do you want to use for Chat?
Application successfully added. 🚀

From that point, you can provide --app prod as an argument to any command. Example:

# Create a new channel in the prod app
$ stream-cli chat create-channel -i redteam -t messaging -u joe --app prod

Delete a configuration:

$ stream-cli config remove prod
[prod] application successfully deleted.


All CRUD channel operations are available in the CLI.

Create a channel:

$ stream-cli chat create-channel -i redteam -t messaging -u joe
Successfully created channel [messaging:redteam2]

Add members to a channel:

$ stream-cli chat add-members --type messaging --id red-team joe jill jane
Successfully added user(s) to channel

Send a message to a channel:

$ stream-cli chat send-message --channel-type messaging --channel-id redteam --text "Hello World!" --user joe
Message successfully sent. Message id: [74c63670-f5ea-4b62-a149-98f434f321c1]

Send a reaction:

$ stream-cli chat send-reaction --message-id 74c63670-f5ea-4b62-a149-98f434f321c1 --user user --reaction-type like
Successfully sent reaction

List channels:

$ stream-cli chat list-channels -t messaging
< json payload >


Validate an import file:

$ stream-cli chat validate-import data.json

Upload a new import:

$ stream-cli chat upload-import data.json --mode insert


Delete users:

$ stream-cli chat delete-users joe jill

Delete channel:

$ stream-cli chat delete-channel --type messaging --id redteam
Successfully initiated channel deletion. Task id: 66bbcdcd-b133-43ce-ab63-557c14d2a168

# Wait for the task to complete
$ stream-cli chat watch 66bbcdcd-b133-43ce-ab63-557c14d2a168
Waiting for async task to complete...⏳
Still loading... ⏳
Async operation completed successfully


Ban a user:

$ stream-cli chat ban-user --target-user-id mike --banned-by admin-user-2 --reason "Bad behavior"

Unban a user:

$ stream-cli chat unban-user --target-user-id joe

Flag a message:

$ stream-cli chat flag-message --message-id msgid-1 --user-id userid-1
Successfully flagged message.

Mute a user:

$ stream-cli chat mute-user --target-user-id joe --muted-by-id admin --expiration 5
Successfully muted user.

Unmute a user:

$ stream-cli chat unmute-user --target-user-id joe --unmuted-by-id admin
Successfully unmuted user.