Migrating from Mesibo v1 to Mesibo v2 APIsEstimated reading time: 4 minutes
In this document, we will describe how to migrate your apps from mesibo v1 to v2 APIs. The new APIs are not only more powerful but also simpler, lighter, battery efficient. The v2 APIs make it even more enjoyable to add real-time communication to your app.
Here are some of the v2 changes at a glance
- Unified messaging APIs for text, media, location, binary data, and more.
- Database Encryption
- Multiple Login Support (releasing soon)
- Battery Efficient
- Image Processing
- URL preview and other UI enhancements
- Mature Content APIs
As we announced in October 22, that v1 APIs would sunset on May 1st, 2023. Although existing users will have more than 6 months, we recommend migrating to v2 APIs immediately.
Migrate your Applications
Migrating from v1 to v2 is very straightforward as explained below. It only involves a few steps. We have already updated GitHub with the new messenger and first app source code which will further help you in visualizing changes.
Update Message Listeners
In v1, you were required to implement four message listeners for text, file, location, and status messages. In addition, you were required to implement listeners for file transfer.
boolean Mesibo_onMessage(MessageParams params, byte data); void Mesibo_onMessageStatus(MessageParams params); void Mesibo_onLocation(MessageParams params, Location location); void Mesibo_onFile(MessageParams params, FileInfo file); boolean Mesibo_onFileTransferProgress(FileInfo file);
In v2, you only need to implement two listeners, one for message and one for status, making your code simpler.
void Mesibo_onMessage(MesiboMessage message); void Mesibo_onMessageStatus(MesiboMessage message);
In addition, you will need to implement one more listener for message updates which is a new feature. Message updates can happen when file transfer is in progress or the message is remotely modified (a new feature to live update messages).
void Mesibo_onMessageUpdate(MesiboMessage message);
Mesibo_On, are now changed to
Use new Unified messaging API
Unlike v1, you no longer need to use different APIs for different types of messages. Instead, you only need to use a unified
MesiboMessage API for all types of messages.
Creating a Message Object
You can create a
MesiboMessage object from the profile of destination user or the group.
// profile can be the user or a group profile MesiboMessage msg = profile.newMessage();
Sending a text message
msg.title = "Title"; msg.message = "Hello, this is the message body"; msg.send();
Sending a rich message with a file or media from the local disk, URL, or even an Image object.
Geotag your messages
You can geotag your messages by adding location infomration along with other content.
msg.latitude = 1.3521; msg.longitude = 103.8198; msg.send();
Sending binary messages
msg.data = data; msg.send();
Custom Fields in Messages
Not only the predefined fields, you can also add custom fields to the message:
msg.setString("Custom1", "some string value"); msg.setInt("Custom2", 123); msg.send();
Message Update / Edit Feature
v2 also have a feature to update sent messages. This feature will allow you to edit messages or even create a dynamic presentation on the fly.
msg.message = "Updated Content"; msg.sendUpdate();
Presence - Typing, Online, etc
Just like messaging, v2 also makes sending presence information simpler.
MesiboPresence p = mProfile.newPresence(); p.sendTyping();
or, even simple,
Renaming of Read Session (Mesibo.ReadDBSession)
Mesibo.ReadDBSession in v1 APIs is now renamed to
v2 APIs also allows you to quickly create a read session from the profile.
MesiboReadSession session = profile.createReadSession();
Renaming of HTTP Helper class (Mesibo.http)
Mesibo.Http class has been renamed to
We have uploaded First App and Messenger source code using the v2 APIs on respective GitHub repos.
Timeline to move from v1 to v2
We suggest you start implementing v2 APIs. Please note the timeline to move from 1.x to 2.x:
- All the new apps created after Dec 1, 2022 will not be able to use v1 APIs. However, all existing apps can continue using v1 APIs till May 1st, 2023
- There will not be any v1 API updates and only limited support for critical issue. We will completely stop supporting v1 APIs from Feb 1st, 2023
- v1 APIs will stop working from May 1st, 2023.
mesibo, v2, android, ios, apis