Message By MetaData

To send custom data along with a message, you can use metaData param provided to all kinds of messages such as Text, Image, audio, video & document.

Text message#

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

var textMessage = MessageParams.text(
toJid: toJid,
replyMessageId: replyMessageId, // Optional
topicId: topicId, // Optional
metaData: metaData, // Optional
textMessageParams: TextMessageParams(messageText: messageText));
Mirrorfly.sendMessage(messageParams: textMessage, flyCallback: (response){
if(response.isSuccess){
}
});
ArgumentTypeDescription
messageParamsMessageParams.textObject to hold the parameters of the text message
flyCallbackFlyResponsecallback to observe the action status

Note : You can listen to incoming messages by using the onMessageReceived listener.

Image message#

To send your image message, you need to pass the MessageParams.image object as an argument to the parameter in the sendMessage() method.

var imageMessage = MessageParams.image(toJid: toJid,
replyMessageId: replyMessageId, //Optional
topicId: topicId, //Optional
metaData: metaData, // Optional
fileMessageParams: FileMessageParams(
file: File(imageFilePath),
caption: caption //Optional
));
Mirrorfly.sendMessage(messageParams: imageMessage, flyCallback: (response){
if(response.isSuccess){
}
});
ArgumentTypeDescription
messageParamsMessageParams.imageObject to hold the parameters of the image message
flyCallbackFlyResponsecallback to observe the action status

Note : You can listen for incoming media messages with the onMessageReceived event. Additionally, use the onMediaStatusUpdated event for status updates, and track upload/download progress using the onUploadDownloadProgressChanged event.

Note : In Mirrorfly.initializeSDK() storageFolderName should be defined to set your own local path to store app media files.

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 MessageParams.video object as an argument to the parameter in the sendMessage() method.

var videoMessage = MessageParams.video(toJid: toJid,
replyMessageId: replyMessageId, //Optional
topicId: topicId, //Optional
metaData: metaData, // Optional
fileMessageParams: FileMessageParams(
file: File(videoFilePath),
caption: caption //Optional
));
Mirrorfly.sendMessage(messageParams: videoMessage, flyCallback: (response){
if(response.isSuccess){
}
});
ArgumentTypeDescription
messageParamsMessageParams.videoObject to hold the parameters of the video message
flyCallbackFlyResponsecallback to observe the action status

Note : You can listen for incoming media messages with the onMessageReceived event. Additionally, use the onMediaStatusUpdated event for status updates, and track upload/download progress using the onUploadDownloadProgressChanged event.

Note : In Mirrorfly.initializeSDK() storageFolderName should be defined to set your own local path to store app media files.

caution

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

Audio message#

To send your audio message, you need to pass the MessageParams.audio object as an argument to the parameter in the sendMessage() method.

var audioMessage = MessageParams.audio(toJid: toJid,
isRecorded: `true` for recorded audio otherwise set `false`
replyMessageId: replyMessageId, //Optional
topicId: topicId, //Optional
metaData: metaData, // Optional
fileMessageParams: FileMessageParams(
file: File(audioFilePath)));
Mirrorfly.sendMessage(messageParams: audioMessage, flyCallback: (response){
if(response.isSuccess){
}
});
ArgumentTypeDescription
messageParamsMessageParams.audioObject to hold the parameters of the audio message
flyCallbackFlyResponsecallback to observe the action status

Note : You can listen for incoming media messages with the onMessageReceived event. Additionally, use the onMediaStatusUpdated event for status updates, and track upload/download progress using the onUploadDownloadProgressChanged event.

Note : In Mirrorfly.initializeSDK() storageFolderName should be defined to set your own local path to store app media files.

caution

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

Document message#

To send your document message, you need to pass the MessageParams.document object as an argument to the parameter in the sendMessage() method.

var documentMessage = MessageParams.document(toJid: toJid,
replyMessageId: replyMessageId, //Optional
topicId: topicId, //Optional
metaData: metaData, // Optional
fileMessageParams: FileMessageParams(
file: File(documentFilePath)));
Mirrorfly.sendMessage(messageParams: documentMessage, flyCallback: (response){
if(response.isSuccess){
}
});
ArgumentTypeDescription
messageParamsMessageParams.documentObject to hold the parameters of the document message
flyCallbackFlyResponsecallback to observe the action status

Note : You can listen for incoming media messages with the onMessageReceived event. Additionally, use the onMediaStatusUpdated event for status updates, and track upload/download progress using the onUploadDownloadProgressChanged event.

Note : In Mirrorfly.initializeSDK() storageFolderName should be defined to set your own local path to store app media files.

caution

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

Location message#

To send your location message, you need to pass the MessageParams.location object as an argument to the parameter in the sendMessage() method.

var locationMessage = MessageParams.location(toJid: toJid,
replyMessageId: replyMessageId, //Optional
topicId: topicId, //Optional
metaData: metaData, // Optional
locationMessageParams: LocationMessageParams(latitude: latitude, longitude: longitude));
Mirrorfly.sendMessage(messageParams: locationMessage, flyCallback: (response){
if(response.isSuccess){
}
});
ArgumentTypeDescription
messageParamsMessageParams.locationObject to hold the parameters of the location message
flyCallbackFlyResponsecallback to observe the action status

Note : You can listen to incoming messages by using the onMessageReceived listener.

caution

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

Contact message#

To send your contact message, you need to pass the MessageParams.contact object as an argument to the parameter in the sendMessage() method.

var contactMessage = MessageParams.contact(toJid: toJid,
replyMessageId: replyMessageID, //Optional
topicId: topicId, //Optional
metaData: metaData, // Optional
contactMessageParams: ContactMessageParams(name: contactName, numbers: contactNumbers));
Mirrorfly.sendMessage(messageParams: contactMessage, flyCallback: (response){
if(response.isSuccess){
}
});
ArgumentTypeDescription
messageParamsMessageParams.contactObject to hold the parameters of the contact message
flyCallbackFlyResponsecallback to observe the action status

Note : You can listen to incoming messages by using the onMessageReceived listener.

caution

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