Messaging API

Flutter messaging API

A message object contains and stores all the information that can be used to send messages.

To send a message to a contact or a group, you must first create a message object:

dynamic message = {
      'to': "userId", // to send message to a contact pass the userId of the receiver (You can ignore the groupId in this case)
      'groupId': groupId, //to send message to a group pass the groupId (You can ignore the userId in this case)
      'message': "message text", // message to send
    };

📘

Note

A message object can have more parameters. Refer to this link: https://docs.applozic.com/docs/android-chat-message-api#build-your-ui-from-scratch---message-api

Then pass the message object to the sendMessage() function to send it:

ApplozicFlutter.sendMessage(message)
    .then((value) => print("Message sent."))
    .catchError((e, s) => print("Error while sending message: " + e.toString()));

What’s Next

Customization

Did this page help you?