How to add dynamically add product of interest to message thread

Hi there, I can’t seem to find information about this topic, so decided to post here.

I run a marketplace and I use sendbird for our DMs.

Here’s what I’m trying to solve: customers frequently will message a vendor and say, for example, “I have a question about this product” – to which the vendor says “which product?” … because there’s no capture of what product the customer is looking at or interested in.

How can I build something to mimic the below screenshots? Where the product is automatically included in the message?

thanks!

Hello @Jack_T ,

Welcome to Sendbird community!

To add a product to a message thread in your marketplace, you can use Sendbird’s metadata feature. Metadata allows you to attach custom information to a message. You can add the product details as metadata to the message, such as the product name, price, description, and image URL. This way, the product information will be associated with the message thread. You can refer to the “Add metadata” section in the “Messaging basics” documentation for more details on how to add metadata to a message.

Thanks Rahul! That’s helpful.

Other question – as in the screenshot from the post, how would I go about creating a customer-facing widget like the “Speaker. $90. Contact seller” modal seen in the example?

Thank you

hello @Jack_T ,

To add a widget like “Contact Seller” , you can follow these steps:

  1. Create a custom message type:
    Define a custom message type for the “Contact Seller” widget. This can be done using the Sendbird SDK’s message customization feature.

  2. Implement the UI component:
    Create a UI component for the “Contact Seller” widget. This component can be a button or any other interactive element that triggers the “Contact Seller” functionality.

  3. Handle the widget interaction:
    Add an event handler to the UI component that handles the interaction with the “Contact Seller” widget. This handler can trigger the necessary actions, such as opening a modal or initiating a new chat session with the seller.

  4. Send the custom message:
    When the user interacts with the “Contact Seller” widget, send a custom message of the defined message type to the chat session. This can be done using the Sendbird SDK’s message sending functionality.

  5. Display the widget in the chat UI:
    When receiving a message of the custom message type, display the “Contact Seller” widget in the chat UI. This can be done by customizing the chat UI components or using the Sendbird SDK’s UI customization features.

Let me know if this helps.

1 Like

thanks Rahul! this is helpful

1 Like