This guide shows how to migrate message and reaction code from stream-chat to getstream.
Before (stream-chat):
from stream_chat import StreamChat
client = StreamChat(api_key="your-api-key", api_secret="your-api-secret")
channel = client.channel("messaging", "general")
response = channel.send_message({"text": "Hello world"}, user_id="user-1")After (getstream):
from getstream import Stream
from getstream.models import MessageRequest
client = Stream(api_key="your-api-key", api_secret="your-api-secret")
channel = client.chat.channel("messaging", "general")
response = channel.send_message(
message=MessageRequest(text="Hello world", user_id="user-1")
)Key changes:
- Message content and
user_idare combined in aMessageRequestobject user_idmoves inside the request model instead of being a separate argument
Before (stream-chat):
from stream_chat import StreamChat
client = StreamChat(api_key="your-api-key", api_secret="your-api-secret")
channel = client.channel("messaging", "general")
response = channel.send_message(
{"text": "Silent notification", "custom_field": "value"},
user_id="user-1",
skip_push=True,
)After (getstream):
from getstream import Stream
from getstream.models import MessageRequest
client = Stream(api_key="your-api-key", api_secret="your-api-secret")
channel = client.chat.channel("messaging", "general")
response = channel.send_message(
message=MessageRequest(
text="Silent notification",
user_id="user-1",
custom={"custom_field": "value"},
),
skip_push=True,
)Key changes:
- Custom fields go in the
customdict onMessageRequest - Send options like
skip_pushremain as keyword arguments onsend_message()
Before (stream-chat):
from stream_chat import StreamChat
client = StreamChat(api_key="your-api-key", api_secret="your-api-secret")
channel = client.channel("messaging", "general")
response = channel.send_message(
{"text": "Reply text", "parent_id": "parent-msg-id"},
user_id="user-1",
)After (getstream):
from getstream import Stream
from getstream.models import MessageRequest
client = Stream(api_key="your-api-key", api_secret="your-api-secret")
channel = client.chat.channel("messaging", "general")
response = channel.send_message(
message=MessageRequest(
text="Reply text",
user_id="user-1",
parent_id="parent-msg-id",
show_in_channel=False,
)
)Key changes:
parent_idis a named field onMessageRequestinstead of a dict keyshow_in_channelcan be set explicitly on the request
Before (stream-chat):
from stream_chat import StreamChat
client = StreamChat(api_key="your-api-key", api_secret="your-api-secret")
response = client.get_message("msg-123")After (getstream):
from getstream import Stream
client = Stream(api_key="your-api-key", api_secret="your-api-secret")
response = client.chat.get_message(id="msg-123")Key changes:
- Called on
client.chatsub-client instead ofclientdirectly
Before (stream-chat):
from stream_chat import StreamChat
client = StreamChat(api_key="your-api-key", api_secret="your-api-secret")
response = client.update_message({
"id": "msg-123",
"text": "Updated text",
"user": {"id": "user-1"},
})After (getstream):
from getstream import Stream
from getstream.models import MessageRequest
client = Stream(api_key="your-api-key", api_secret="your-api-secret")
response = client.chat.update_message(
id="msg-123",
message=MessageRequest(text="Updated text"),
)Key changes:
- Message ID is a separate
idparameter, not part of the message dict - No need to embed
userinside the message; the SDK handles authentication
Before (stream-chat):
from stream_chat import StreamChat
client = StreamChat(api_key="your-api-key", api_secret="your-api-secret")
response = client.update_message_partial(
message_id="msg-123",
updates={"set": {"text": "Edited text"}, "unset": ["old_field"]},
user_id="user-1",
)After (getstream):
from getstream import Stream
client = Stream(api_key="your-api-key", api_secret="your-api-secret")
response = client.chat.update_message_partial(
id="msg-123",
set={"text": "Edited text"},
unset=["old_field"],
)Key changes:
setandunsetare top-level keyword arguments instead of a nestedupdatesdictmessage_idrenamed toid
Before (stream-chat):
from stream_chat import StreamChat
client = StreamChat(api_key="your-api-key", api_secret="your-api-secret")
response = client.delete_message("msg-123")After (getstream):
from getstream import Stream
client = Stream(api_key="your-api-key", api_secret="your-api-secret")
response = client.chat.delete_message(id="msg-123", hard=False)Key changes:
- Called on
client.chatsub-client hardparameter is explicit (defaults to soft delete)
Before (stream-chat):
from stream_chat import StreamChat
client = StreamChat(api_key="your-api-key", api_secret="your-api-secret")
channel = client.channel("messaging", "general")
response = channel.send_reaction(
message_id="msg-123",
reaction={"type": "love", "count": 42},
user_id="user-1",
)After (getstream):
from getstream import Stream
from getstream.models import ReactionRequest
client = Stream(api_key="your-api-key", api_secret="your-api-secret")
response = client.chat.send_reaction(
id="msg-123",
reaction=ReactionRequest(type="love", score=42),
enforce_unique=False,
)Key changes:
- Called on
client.chatsub-client instead of the channel object - Uses
ReactionRequestinstead of a plain dict countfield renamed toscoreuser_idcan be passed insideReactionRequest(user_id=...)when needed (e.g. server-side reactions on behalf of a user)enforce_uniquecontrols whether a user can add multiple reactions of the same type (whenTrue, the new reaction replaces any existing one of the same type by that user)
Before (stream-chat):
from stream_chat import StreamChat
client = StreamChat(api_key="your-api-key", api_secret="your-api-secret")
channel = client.channel("messaging", "general")
response = channel.get_reactions("msg-123", limit=10, offset=0)After (getstream):
from getstream import Stream
client = Stream(api_key="your-api-key", api_secret="your-api-secret")
response = client.chat.get_reactions(id="msg-123", limit=10, offset=0)Key changes:
- Called on
client.chatsub-client instead of the channel object - Message ID passed as
idkeyword argument
Before (stream-chat):
from stream_chat import StreamChat
client = StreamChat(api_key="your-api-key", api_secret="your-api-secret")
channel = client.channel("messaging", "general")
response = channel.delete_reaction("msg-123", reaction_type="love", user_id="user-1")After (getstream):
from getstream import Stream
client = Stream(api_key="your-api-key", api_secret="your-api-secret")
response = client.chat.delete_reaction(
id="msg-123",
type="love",
user_id="user-1",
)Key changes:
- Called on
client.chatsub-client instead of the channel object reaction_typerenamed totype