Pre-baked Messages

I see brief mention of “Structured Messages” in the features list of sendbird:

Structured messages

Allow developers to display offers in the chat interface and design custom messages for specific situations.

I can’t find any in-depth documentation around this. We want to offer a few, short, prebaked messages like “just arrived!”, “taking a break”, “heading out” to our interface. Think Uber’s in app chat. Is this what structured messages is? If so, where are the docs?

Thanks!
Tucker
Gigpro

Hello @Tucker and welcome to the Sendbird community!

Structured Messages would not be like pre-baked messages, they are referring to the ability to share structured data, such as interactive cards, product carousel cards, or location maps.

This is typically accomplished through the use of a message’s message, customType, data, and metaArrays properties. You can assign messages a customType and store any data needed to render the
structured or custom message in the message’s message, data, or metaArrays fields depending on what is needed.

As for pre-baked messages, one possible way to implement it is through a channels DATA property. For example when a channel is created you could supply JSON string in as the DATA of the channel, {"QuickReplies" : ["Just Arrived!", "Heading out"]}.

Then when a channel is fetched you can grab the “QuickReplies” element from the channels DATA property and use internal logic to determine if the quick replies should be rendered and what happens when they are clicked, which would most likely just be sending the quick reply message to the channel.

Alternatively you could use channel metadata to store the messages, User & channel metadata | Chat iOS SDK | Sendbird Docs.

1 Like