The Rich Media Preview Extension allows the developer to generate rich preview panels for all the popular sites. This extension fetches the first URL from the message for the generation of a preview.
If the text message contains a URL, the extension will create a Preview using your iFramely credentials. These details can then be used to show a nice preview card for that URL.The information about the Preview will be updated later for the message and hence you need to implement the onMessageEdited listener. Please check our Edit message documentation under the SDK of your choice.Here is a sample response (for https://stackoverflow.com):
At the recipients’ end, from the message object, you can fetch the metadata by calling the getMetadata() method. Using this metadata, you can fetch the Rich Media Embed.
Copy
Ask AI
var metadata = message.getMetadata();if (metadata != null) { var injectedObject = metadata["@injected"]; if (injectedObject != null && injectedObject.hasOwnProperty("extensions")) { var extensionsObject = injectedObject["extensions"]; if (extensionsObject != null && extensionsObject.hasOwnProperty("rich-media")) { var richMediaObject = extensionsObject["rich-media"]; } }}