Basic Concepts: Anatomy of a Mesibo ApplicationEstimated reading time: 5 minutes
Here, we will briefly describe the types of APIs that you use to build any kind of mesibo application. Once you are familiar with the basic Mesibo API flow, you can use it on any platform that Mesibo supports.
At a high level, there are two types of mesibo APIs that you should be familiar with to build any kind of Mesibo Application:
Mesibo Backend APIs, you will use this APIs from your backend. These are REST-based APIs that allow your backend servers to communicate with Mesibo to perform various administrative tasks such as managing users and groups, managing apps, access statistics.
Mesibo Real-Time APIs, you use these APIs from your user side apps e.g., from Android, iOS, Web, C++, Python, etc. These APIs allow the users of your app to communicate in real-time by providing APIs for 1-to-1 messaging, group messaging, voice and video calls, etc.
Let’s explore in more detail.
Mesibo Backend APIs
Mesibo backend APIs allow you to administer your account, manage apps, manage users and groups, etc. Mesibo backend API is a REST-based API that you can access using any language of your choice. You will require an App Token to use backend APIs, which you can get it from the mesibo console.
The backend API should only be accessed from your backend servers. Your users (clients) MUST NOT access backend APIs directly as it will expose your app tokens. For the privacy of your app data, mesibo will disable the app if the breach is detected.
Here you can find a list of all the backend operations that you can perform along with the different APIs that you need to use for each operation.
To build any kind of application with mesibo, you need to set up the following using backend APIs:
First, you need to create an application in the mesibo console. Once you create an application, you will get a secret App Token. You need to use this app token in all your backend APIs to create users, groups, etc for your application. Please note that each App Token is unique and is used to identify a single application.
Next, you need to create users and generate a user access tokens for each user. This user access token will be used in real-time APIs for messaging and calls, as explained in the next section.
In short, you will be using a secret App Token in mesibo backend APIs to manage app related activities like creating users, groups, generating user access tokens, etc. And the users of your application will be needing user access tokens connect to your mesibo application and communicate with each other.
You will learn more about creating an application and users(endpoints), in the next section Getting Started: Create Users.
Mesibo Real-Time APIs
These are user side APIs that allow the users of your app to communicate in real-time by providing APIs for 1-to-1 messaging, group messaging, voice and video calls, etc. You will use these APIs to integrate with your user-side applications (e.g., Android, iOS, Web, C++, Python, etc)
Mesibo makes it remarkably simple to send real-time messages from one endpoint to another.
- to send a text message, call
- to send a group message, call
group IDand the
- to send a file, such as an image you can use
- to read messages from the database, you can use
Based on the type of data (message) you need to send, there is a wide range of API functions you can use. Additionally, Mesibo provides numerous APIs for other functionalities like storing and retrieving messages in the database, connectivity check, etc.
Since your app can receive messages or calls anytime, you instruct Mesibo to let your app know when it happens. You can do it by passing a Callback object to Mesibo. When a particular event occurs, Mesibo will invoke an appropriate callback to let your app know about the event. The event could be:
- a message was received
- a message was sent
- a message was delivered
- a message was read
- a call received
- your app is online
- network issues
The following are some of the callbacks. For the entire list and more details, refer listener API documentation:
Invoked when the connection status is changed. There are different connection status codes, based on which you can get to know whether your app is online/offline.
Invoked when the status of the outgoing or sent message is changed. For example,
- a message was sent from the device
- received by the recipient
- read by the recipient
Invoked on receiving a new message or reading database messages. The message parameters of this function will contain the
peer, which will inform you who sent the message, and the
data parameter will contain the message data.