When a customer sends a message from a client app that includes a link, Link preview enables to provide a preview text or a thumbnail image of the URL. In this way, a sender and a receiver of the message can be aware of what they're going to see before they open the link.
To provide a link preview by updating a message, every user message sent from a client app should be checked if it includes any URLs through the detector.
Implement the code to parse the HTML source of a URL in a customer's message and extract the OpenGraph metadata of the URL. Then, set the extracted OG metadata as a
JSON object and stringify the object to pass it as an argument to a data parameter in the
SBDGroupChannel.update(userMessage, messageText, data, customType, completionHandler) method.
Note: There are various methods to extract OG metadata from the HTML body. You can refer to our GitHub repository for the method we're using.
As a result, the original message is updated with a link preview through the
SBDGroupChannel.update() of the
SBDChannelDelegate, and a sender and a receiver of the message can see a preview of the link on their app or a web.