New Chat Feature: Custom User Events for Friend Requests, Dating Matches, & More

Custom Events help app developers build more complex interactions with a user or within a messaging channel when working with the Stream Chat API. For example, custom friendship data can be used to set up events to notify users when a friendship has been requested and when it has been accepted, and to trigger the creation of a 1:1 messaging channel for those users.

Mike R.
Mike R.
Published May 26, 2021
code snippet showing how chat api custom events can be used for social media friend requests

In many social networking and dating applications, in-app chat and messaging functionality accompanies complex relationships between individual users. These apps need to support open-ended communications, like a friend request that may or may not be accepted or a dating match that may or may not spark a conversation.

For software teams integrating a chat API like Stream Chat to power communication, the uncertain nature of these events can raise questions about best practices in terms of channel creation, channel membership, and other decisions. Stream engineers have been working closely with customers in the social app space to understand their needs and are excited to announce updates to Custom Events to serve these use cases.

In particular, new Custom User Events help simplify friend requests and dating matches by providing the option to delay chat channel creation until both parties have agreed to connect. Learn more about when to send custom events to users vs. channels below.

View full technical documentation for Custom Events→

Sending Custom Events to a Channel vs. to a User

Custom events can be sent either to a channel or to a user. They can be sent to a channel on the server side or client side, while sending custom events to a user is restricted to server side only.

To a Channel

When a custom event is sent to a channel, the event is delivered to all users watching the channel. This works well in a live chat use case for customer support, for example, with a channel between a support agent and a customer. A custom event could be sent to the channel when a support ticket is created or resolved, displaying a summary in the chat window. Taking this a step further, the custom event could even be configured so that resolving the support ticket automatically freezes the channel.

To a User

You can now also configure your app to send custom events directly to a connected user, delivering the event to all of that user’s connected clients. This can be a more efficient workflow when you want the recipient to accept the friend request or dating match in a separate notification pane before a private chat channel is ever created for the two users. Learn more about how to set up Custom User Events.

Try Stream Chat for Social Messaging

The Stream Chat API and client-side SDKs make it easy to integrate a high-performance, feature-rich messaging experience into your social networking or dating app without the need to develop scalable chat infrastructure in-house. In addition to Custom Events, many additional features like message reactions, threaded replies, and powerful moderation tools make Stream Chat a match to provide the advanced social messaging experiences today’s users expect.

Activate your free Stream Chat trial to begin testing your app integration today.

decorative lines
Integrating Video with your App?
We've built a Video and Audio solution just for you. Check out our APIs and SDKs.
Learn more ->