CometChat Pro Documentation

You'll find comprehensive guides and documentation to help you start working with CometChat as quickly as possible. Let's jump right in!

Smart Reply

The Smart Reply extension allows you to show quick reply options to a user so that they can easily respond to a message. We will always suggest 3 options; one positive, one neutral and one negative. We also add a category, in case you want to skip some suggestions.

When a user sends a message, our Smart Reply extension will add metadata while the message is in-flight. The recipient will receive the message with metadata suggesting the response.

Here is a sample response that you will receive in the metadata of the message.

"@injected": {
  "extensions": {
    "smart-reply": {
      "reply_positive": "This is awesome!",
      "reply_neutral": "That's fine",
      "reply_negative": "This is awful",
      "category": "how_is_it"

You can use this information to build a UI like this:

How to show smart replies in your UI

How to show smart replies in your UI

At the recipients' end, from the message object, you can fetch the metadata by calling the getMetadata() method. Using this metadata, you can fetch suggested responses for the message.

var metadata : [String : Any]? = textMessage.metaData
if metadata != nil {
  var injectedObject : [String : Any]? = (metadata?["@injected"] as? [String : Any])!
  if injectedObject != nil && (injectedObject!["extensions"] != nil){
    var extensionsObject : [String : Any]? = injectedObject?["extensions"] as? [String : Any]
    if extensionsObject != nil && extensionsObject?["smart-reply"] != nil {
      var smartReply = extensionsObject?["smart-reply"] as! [String :  Any]
      let reply_positive = smartReply["reply_positive"]
      let reply_neutral = smartReply["reply_neutral"]
      let reply_negative = smartReply["reply_negative"]
      let category = smartReply["category"]

Smart Reply

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.