Build Your Own Messenger With Real-Time Chat & Video APIs
Add instant messaging and online video chat to any Android, iOS, or Web application, with ease and flexibility. In-app chat and calling APIs and SDKs, trusted globally by developers, startups, and enterprises.
Launch quickly and convert more prospects with real‑time Chat, Audio, and Video communication
If you own a product, you know exactly how drawn-out and exorbitant it can be to build to build real-time communication features from scratch. Quickblox can help you design, create, and enter the market at a much faster rate with APIs and SDKs that shortcut product and engineering delivery. Convert your ideas into a successful product with us and watch the engagement rate rise, while you build a loyal user base.
Protect your data from hackers and unwanted modification attempts using flexible data storage options. Choose between dedicated, on-premise, or your own virtual cloud.
Secure File Sharing
Allow sharing and linking of all types of files (images, audio, video, docs, and other file formats) and enable your users to interact and engage more.
Over 30,000 software developers and organizations worldwide are using QuickBlox messaging API.
enterprise instances
applications
chats per day
requests per month
Wherever you are in your product journey, we have chat, voice, and video APIs ready to build new features into your app
Quickblox APIs are equipped to support mobile applications and websites at different stages, be it a fresh product idea, an MVP, early stage startup or a scaling enterprise. Our documentation and developer support are highly efficient to make your dream product a reality.
Chat API and Feature-Rich SDKs
Our versatile software is designed for multi‑platform use including iOS, Android, and the Web.
SDKs and Code Samples:
Cross-platform kits and sample apps for easy and quick integration of chat.
Restful API:
Enable real-time communication via the server.
UI Kits:
Customize everything as you want with our ready UI Kits.
Q-Consultation:
White‑label solution for teleconsultation and similar use cases.
Fully Customizable White Label Solutions
Customizable UI Kits to speed up your design workflow and build a product of your vision as well as a ready white‑label solution for virtual rooms and video calling use cases.
Cloud & Dedicated Infrastructure
Host your apps wherever you want - opt for a dedicated fully managed server or on‑premises infrastructure. Pick a cloud provider that’s best as per your business goals.
Cloud:
A dedicated QuickBlox cloud or your own virtual cloud?
On-Premise:
Deployed and managed on your own physical server.
Docs:
Integrating QuickBlox across multiple platforms.
Support:
Quickblox support is a click away.
Rich Documentation & Constant Support
Get easy step by step guidance to build a powerful chat/messaging/communication app. Easily integrate new features using our documentation and developer support.
Do you need additional security, compliance, and support for the long-term ?
We have a more scalable and flexible solution for you, customized to your unique business/app requirements.
Insanely powerful in-app chat solutions- for every industry
Healthcare
Provide better care for your patients and teams using feature-rich HIPAA‑compliant chat solutions. Integrate powerful telemedicine communication tools into your existing platform.
Finance & Banking
Secure communication solutions for the financial and banking industry to support your clients. Easily integrated with your banking APIs with full customization available.
Marketplaces & E-commerce
Integrate chat and calling into your e‑commerce marketplace platform to connect with customers using chat, audio, and video calling features.
Social Networking
Give your users the option to connect one-on-one or with a group, using high quality voice, video, and chatbox app features - build a well connected community.
Education & Coaching
Add communication functions to connect teachers with students, coaches with players, and trainers with clients. Appropriate for any remote learning application.
Trusted by Developers & Product Owners
Communication with the QuickBlox team has been great. The QuickBlox team is a vital partner and I appreciate their support, their platform, and its capabilities.
Justin Harr, Founder, Eden
What I like best about QuickBlox is their reliability and performance - I've rarely experienced any issues with their solutions, whether I'm using their video or voice SDK, or their chat API.
Itay Shechter, Co-founder, Vanywhere
QuickBlox chat has enhanced our platform and allowed us to facilitate better communication and caregivers and care coordinators
Robin Jerome, Principal Architect, BayShore HealthCare
I have worked with QuickBlox for several years using their Flutter SDK to add chat features to several client apps. Their SDKs are easy to work with, saving us much time and money not having to build chat from scratch.
How to Build an Instant Messaging App with QuickBlox and Vue.js
Hamza Mousa
28 May 2021
QuickBlox is communication as an infrastructure platform (CPaaS), which focuses on providing secure privacy-aware messaging functionalities to enterprises. The current QuickBlox features include real-time instant messaging, HD video calling with high-quality audio communication, file-sharing, and push notifications.
QuickBlox has a set of software development kits (SDKs) with full native libraries for mobile platforms such as iOS and Android. It also offers full support for Flutter, React Native, and RESTful API.
To say the least, the platform is a Swiss Army knife for creating interactive rich communication and messaging apps that can cover different use-cases and scopes.
In this article we will demonstrate how to create a messaging application with the Vue JavaScript framework. But first, let us explain why did we choose Vue.js?
Vue is a JavaScript framework for creating web and mobile applications. It has a large community of developers who pack it with countless numbers of libraries, frameworks, and UI components.
Vue’s vast ecosystem is rich with open-source components, code samples, and frameworks that ease the production of a stable solution.
With Vue, developers can create several types of applications starting from statically generated websites, web components (web widgets), mobile applications, control dashboards, API-based websites, and highly dynamic websites with its server-side rendering capabilities.
Vue can be used for creating mobile applications with frameworks like Ionic and Framework7. Furthermore, with some tweaks using Electron, developers can build a fancy desktop application with it.
Requirements
You can install Vue with NPM or YARN. note that it requires admin permission to be installed on macOS and Linux.
npm install -g @vue/cli or yarn global add @vue/cli.
Now let’s make sure Vue is installed.
$ vue --version
@vue/cli 4.5.9
Create your project
To create a new project with Vue, we simply use vue create project_name.
vue create quickblox-chat
Soon as you enter the project creation command, Vue will ask you which Vue will you use, we will use Vue 2 because it has a larger ecosystem for plugins and UI components.
Default ([Vue 2] babel, eslint)
Project setup
Switch to the project’s folder and install the required libraries. Our core library here is QuickBlox JavaScript SDK which provides us with all QuickBlox functionality with simple API.
Buefy is a Bulma CSS framework packed as Vue components. We need it here for more than styling and the design, as it also has many reactive libraries like toast, modal, dialog, alerting and more.
LowDash is a rich JavaScript functional library which comes handy for working with arrays, collections and data manipulation.
Moment.js is a lightweight library for data, time, duration and time-differences manipulation.
js
import Vue from 'vue'
import App from './App.vue'
import Buefy from 'buefy'
import 'buefy/dist/buefy.css'
Vue.use(require('vue-moment'));
Vue.use(Buefy)
Vue.config.productionTip = false
new Vue({
render: h => h(App),
}).$mount('#app')
QuickBlox Setup
In order to start working with QuickBlox API, you need to create an application from the QuickBlox developer’s dashboard. This step will provide you with the Application ID, Authorization key and Authorization secret which you need for creating your app.
QuickBlox Init
Now as we have everything ready let’s import QuickBlox SDK and setup the app credentials.
LowDB is lightweight local JSON database library. It’s powered by Lodash and supports local flat-file, in-memory database and localStorage for the browser. I use it for small projects as a reactive storage for configurations and to provide a local database support.
In the next code snippet at App.vue we will import `lowdb` and setup our local database support. we can setup the default configurations for our app as we see fit.
As you noticed in the code above, we initiated QuickBlox connection within created section which will be used as well to subscribe for new messages.
Creating Login Template
First step of our workflow is the user’s login. Here we will create a template for user’s login in App.vue.
We will create everything in one file to make is easier to read, modify and edit. The main goal is to demonstrate using Vue to build QuickBlox-based apps. You can re-create the experience later using the full power of Vue, create a re-usable components, complex routes, vues and of-course add more QuickBlox functionalities.
In the next Vue code snippet, we are implementing a full QuickBlox workflow: login, getting a user’s ID, connecting to a dialog which can be one of three:
1-1 dialog which acts like a direct message between two users;
group dialog is for group messaging;
public dialog that works similar to a public channel.
The next code will work the same for all the mentioned dialog types.
Our steps here will be as follow:
Login: creating a login Session;
Get the user details;
Connect to a certain dialog;
Retrieve the last messages;
Send messages to the dialog.
js
// methods
login() {
let self = this;
var params = {
login: this.username,
password: this.password
}
QB.createSession(params, function (err, result) {
// callback function
if (err) {
self.toast('danger', 'Session error: Can`t login to QB')
} else {
self.toast('success', 'Login success, loading messages')
self.loggedIn = true;
self.isLoading = true;
self.getUserId(params.login, params.password)
}
});
},
getUserId(login, password) {
var self = this;
var searchParams = {
login: login
};
QB.users.get(searchParams, function (error, user) {
if (!error) {
self.connect({
userId: user.id,
password: password
})
}else{
self.toast('danger', 'Could not get the userID')
}
});
},
connect(userCredentials) {
let self = this;
QB.chat.connect(userCredentials, function (error, contactList) {
if (!error) {
self.toast('success', 'Dialog connection success')
var roomId = CREDENTIALS.roomJID;
// Join Specific Room
QB.chat.muc.join(roomId, function (error, result) {
if (error) {
self.toast('danger', 'Could not join the dialog')
return
}
self.toast('success', 'Connected to dialog: Success')
var dialogId = result.dialogId
// Getting Messages List
self.getMessages(dialogId)
});
} else {
self.toast('danger', 'QB Connection Error')
}
});
},
// Reterive the dialog messages
getMessages(dialogId) {
let self = this;
self.toast('warning', 'Getting the Dialog Messages...')
var params = {
chat_dialog_id: dialogId,
sort_desc: 'date_sent',
limit: 10,
skip: 0
};
QB.chat.message.list(params, function (error, messages) {
if (!error) {
self.toast('success', 'Retrieving messages: ' + messages.limit)
self.isLoading = false;
if (messages.limit > 0) {
self.messages = _.reverse(messages.items);
var userIDs = _.map(messages.items, (msg) => {
return msg.sender_id
})
self.userIDs = userIDs;
self.getUsers(userIDs)
}
} else {
self.toast('error', 'Retrieving messages: error')
}
});
}
Get User details
To get the user details like the full name and email , we have to access the users data through the API. Here we use QB.users.listUsers to list all the current users. We will save this in a separate collection.
js
getUsers(userIds) {
let self = this;
var searchParams = {
filter: {
field: 'id',
param: 'in',
value: userIds
}
};
// Get user
QB.users.listUsers(searchParams, function (error, result) {
if (!error) {
self.users = result.items
} else {
console.error('Could not get the user details [QB.users.listUsers]')
}
});
},
getUserName(id){
var users = JSON.parse(JSON.stringify(this.users))
var user = _.find(users,(o)=>{return o.user.id == id})
if(user){
return user.user.full_name;
}
}
Send a new Message
The last step will handle sending a new message. It requires the dialog ID and few optional parameters. One of them is significant in-case you want to save the message on the server.
You may notice that we didn’t use LowDB yet for this application. It can be used to save configurations, save certain JSON collections, perform search in a complex collection and of course as a localStorage interface.
Scroll to the recent message
We need to automate the scrolling to the last message.
As We just scratched the serfece with this tutorial, We can see that building messaging application with Vue and QuickBlox is a hustle-free experience. QuickBlox is full of feature to create a rich messaging experiance which we can add easily with the JavaScript SDK.
The application can be extended with QuickBox WebRTC functionalities for video calling and conferencing apps.
With some tweaks, this Vue app can work on Desktop, deploy to a web server, or even build for mobile with Cordova.