A Flutter plugin for Zalo APIs.

Note: This plugin is still under development, and some APIs might not be available yet. Feedback and Pull Requests are most welcome!

1. Setup

1.1 Create app Zalo

To access Zalo APIs, you'll need to make sure to create your application.

1.2 Get ZaloAppID

Then, you access to Dashboard (https://developers.zalo.me/app/[ZaloAppID]/settings). Remember your ZaloAppID

1.3 Import the package

To use this plugin, follow the plugin installation instructions.

1.4 Android integration

  1. Open android/app/build.gradle and edit
minSdkVersion 18 // or bigger
  1. Open to /android/app/src/main/AndroidManifest.xml and edit


       <!-- ZaloFlutter -->
           android:value="@string/zalo_flutter_app_id" />
               <action android:name="android.intent.action.VIEW"/>
               <category android:name="android.intent.category.DEFAULT"/>
               <category android:name="android.intent.category.BROWSABLE"/>
               <data android:scheme="@string/zalo_flutter_app_id_protocol"/>
  1. Create file strings.xml(if not exists) on folder /android/app/src/main/res/values/strings.xml. Replace with your ZaloAppID
    <string name="zalo_flutter_app_id">[ZaloAppID]</string>
    <string name="zalo_flutter_app_id_protocol">zalo-[ZaloAppID]</string>
  1. Open file main.dart and add this function to get HashKey
  void initState() {
    _initZaloFlutter(); // Add this line

  // Add this function
  Future<void> _initZaloFlutter() async {
    if (Platform.isAndroid) {
      final hashKey = await ZaloFlutter.getHashKeyAndroid();
      log('HashKey: $hashKey');

Then, you see Debug console and copy HashKey

  1. Open Zalo Dashboard => Login => Android (https://developers.zalo.me/app/[ZaloAppID]/login)

Paste HashKey and YourPackageName to this page and press Save

Continue with Kotlin

  • Edit the file MainActivity.kt as below. Remember YourPackageName
package [YourPackageName]

import android.content.Intent
import io.flutter.embedding.android.FlutterActivity
import com.zing.zalo.zalosdk.oauth.ZaloSDK // <-- Add this line

class MainActivity: FlutterActivity() {
    override fun onActivityResult(requestCode:Int, resultCode:Int, data: Intent) {
        super.onActivityResult(requestCode, resultCode, data)
        ZaloSDK.Instance.onActivityResult(this, requestCode, resultCode, data) // <-- Add this line
  • Create file MyApplication.kt in same folder of MainActivity.kt. Replace with your YourPackageName
package [YourPackageName]

import io.flutter.app.FlutterApplication
import io.flutter.plugin.common.PluginRegistry
import com.zing.zalo.zalosdk.oauth.ZaloSDKApplication

class MyApplication : FlutterApplication(), PluginRegistry.PluginRegistrantCallback {
    override fun onCreate() {
    override fun registerWith(registry: PluginRegistry) {}

Continue with Java

  • Edit the file MainActivity.java as below. Remember YourPackageName
package [YourPackageName];

import androidx.annotation.NonNull;
import io.flutter.embedding.android.FlutterActivity;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.plugins.GeneratedPluginRegistrant;

import android.content.Intent;
import com.zing.zalo.zalosdk.oauth.ZaloSDK; // Add this line

public class MainActivity extends FlutterActivity {
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        ZaloSDK.Instance.onActivityResult(this, requestCode, resultCode, data); // Add this line
  • Create file MyApplication.java in same folder of MainActivity.java. Replace with your YourPackageName
package [YourPackageName]

import android.app.Application;

import com.zing.zalo.zalosdk.oauth.ZaloSDKApplication;

public class MyApplication extends Application {
    public void onCreate() {

iOS integration

  1. Open ios/Runner/Info.plist file, edit and replace with your ZaloAppID
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">

	<!-- ZaloFlutter start-->
      <!-- ZaloFlutter end-->
  1. Open ios/Runner.xcodeproj/project.pbxproj, search PRODUCT_BUNDLE_IDENTIFIER and copy your BundleID
  1. Open Zalo Dashboard => Login => IOS (https://developers.zalo.me/app/[ZaloAppID]/login) Paste BundleID to this page and press Save


Add the following import to your Dart code:

import 'package:zalo_flutter/zalo_flutter.dart';


  • Get HashKey Android for register app in dashboard Zalo
String? data = await ZaloFlutter.getHashKeyAndroid();
  • Authenticate (with app or webview)
ZaloLogin data = await ZaloFlutter.login();
  • Check if authenticated
bool data = await ZaloFlutter.isLogin();
  • Log out - SDK clear oauth code in cache
await ZaloFlutter.logout();
  • Get Zalo user profile
ZaloProfile data = await ZaloFlutter.getUserProfile();
  • Get Zalo user friend list (used app)
ZaloUserFriend data = await ZaloFlutter.getUserFriendList();
  • Get Zalo user friend list (not used app)
ZaloUserFriend data = await ZaloFlutter.getUserInvitableFriendList();
  • Send message to a friend
ZaloSendMessage data = await ZaloFlutter.sendMessage(to: "zaloId",message: "zaloMessage",link: "zaloMessageLink");
  • Post feed
ZaloPostFeed data = await ZaloFlutter.postFeed(message: "zaloContentPost",link: "zaloLinkPost");
  • Send app request
ZaloSendAppRequest data = await ZaloFlutter.sendAppRequest(to: ["zaloId1, zaloId2"], message: "zaloMessage",);


Pham Tien Dung

If you have any questions, feel free to message me right away

Gmail: tiendung01023@gmail.com

Github: https://github.com/tiendung01023

Linkedin: https://www.linkedin.com/in/tiendung01023

Facebook: https://www.facebook.com/tiendung01023