Mention

To Mention user along with a message in a group, you can use mentionedUsersIds param provided to all kinds of messages such as Text, Image and video

Text message#

To send your text message, you need to pass the TextMessage object as an argument to the parameter in the sendTextMessage() method.

    var textMessage = TextMessage()
    textMessage.toId = TO_JID
    textMessage.messageText = MESSAGE
    textMessage.mentionedUsersIds = MENTION_IDS
    FlyMessenger.sendTextMessage(messageParams: textMessage) { isSuccess, error, chatMessage in
    if (isSuccess) {
    //you can add this message object to your arraylist,
    //then you can notify the tableview
    }
    }
    ArgumentTypeDescription
    MESSAGE_PARAMSTextMessageObject to hold the parameters of the text message
    CALLBACKFlySendMessageListenercallback to observe the action status

    Image message#

    To send your image message, you need to pass the FileMessage object with FileMessageParams set as an argument to the parameter in the sendMediaFileMessage() method.

      var fileMessageParams = FileMessageParams()
      fileMessageParams.fileUrl = FILE_URL
      fileMessageParams.fileName = FILE_NAME
      fileMessageParams.fileSize = FILE_SIZE
      fileMessageParams.thumbImage = THUMB_IMAGE
      fileMessageParams.caption = CAPTION
      fileMessageParams.fileKey = FILE_KEY
      var fileMessage = FileMessage()
      fileMessage.toId = TO_JID
      fileMessage.messageType = MessageType.image
      fileMessage.fileMessage = fileMessageParams
      fileMessage.mentionedUsersIds = MENTION_IDS
      FlyMessenger.sendMediaFileMessage(messageParams: fileMessage){ isSuccess,error,message in
      if (isSuccess) {
      //you can add this message object to your arraylist,
      //then you can notify the tableview
      }
      }
      ArgumentTypeDescription
      MESSAGE_PARAMSFileMessageObject to hold the parameters of the image message
      CALLBACKFlySendMessageListenercallback to observe the action status

      To get the metadata of an image file for sending images make use of the utility methods MediaUtils.getAssetsImageInfo() and MediaUtils.compressImage()

      caution

      If Image attachment feature unavailable for your plan then it will throw 403 exception.

      Video message#

      To send your video message, you need to pass the FileMessage object with FileMessageParams set as an argument to the parameter in the sendMediaFileMessage() method.

        var fileMessageParams = FileMessageParams()
        fileMessageParams.fileUrl = FILE_URL
        fileMessageParams.fileName = FILE_NAME
        fileMessageParams.fileSize = FILE_SIZE
        fileMessageParams.duration = DURATION
        fileMessageParams.thumbImage = THUMB_IMAGE
        fileMessageParams.caption = CAPTION
        fileMessageParams.fileKey = FILE_KEY
        var fileMessage = FileMessage()
        fileMessage.toId = TO_JID
        fileMessage.messageType = MessageType.video
        fileMessage.fileMessage = fileMessageParams
        fileMessage.mentionedUsersIds = MENTION_IDS
        FlyMessenger.sendMediaFileMessage(messageParams: fileMessage){ isSuccess,error,message in
        if (isSuccess) {
        //you can add this message object to your arraylist,
        //then you can notify the tableview
        }
        }
        ArgumentTypeDescription
        MESSAGE_PARAMSFileMessageObject to hold the parameters of the video message
        LISTENERFlySendMessageListenercallback to observe the action status

        To get the metadata of a video file for sending videos make use of the utility methods MediaUtils.processVideo() and MediaUtils.compressVideo()

        caution

        If Video attachment feature unavailable for your plan then it will throw 403 exception.

        Send Reply message#

        To send reply message to the original message, you need to pass the additional parameter original message-id in replyMessageId. TextMessage object as an argument to the parameter in the sendTextMessage()

          var textMessage = TextMessage()
          textMessage.toId = TO_JID
          textMessage.messageText = MESSAGE
          textMessage.replyMessageId = REPLY_MESSAGE_ID // Optional
          textMessage.mentionedUsersIds = MENTION_IDS
          FlyMessenger.sendTextMessage(messageParams: textMessage) { isSuccess, error, chatMessage in
          if (isSuccess) {
          //you can add this message object to your arraylist,
          //then you can notify the tableview
          }
          }
          ArgumentTypeDescription
          MESSAGE_PARAMSTextMessageObject to hold the parameters of the text message
          CALLBACKFlySendMessageListenercallback to observe the action status

          Receive Message#

          To receive a mention related message from another user in a group you must implement the messageListener function. It’s a function that will be triggered whenever you receive a new message or related event in the chat.

            func onMessageReceived(message : ChatMessage, chatJid: String) {
            }
            info

            To learn more on message listener callbacks, see the Message Events Delegate.