Connect Openclaw to Zalo: A Step-by-Step Guide

Image
Table of contents: [Show]

Quick Start

This guide walks you through connecting Openclaw to Zalo, Vietnam's most popular messaging platform. By the end, your AI agent will be able to receive and respond to messages from Zalo users through a dedicated bot account.

Openclaw Zalo Integration

Prerequisites

  • An active Openclaw Gateway running on your host machine
  • A Zalo account for creating a bot
  • Access to the Zalo Bot Platform

Step 1: Create a Zalo Bot

  1. Visit the Zalo Bot Platform and sign in with your Zalo account.
  2. Click Create New Bot and configure your bot's name, avatar, and description.
  3. Once created, navigate to the bot's settings and copy the Bot Token (format: 12345689:abc-xyz).

Step 2: Install the Zalo Plugin

The Zalo integration ships as an optional plugin. Install it via the CLI:

Openclaw plugins install @Openclaw/zalo

Step 3: Configure Openclaw

Add your bot token to the Openclaw configuration file. Edit ~/.Openclaw/Openclaw.json:

{
"channels": {
"zalo": {
"enabled": true,
"botToken": "12345689:abc-xyz",
"dmPolicy": "pairing"
}
}
}

Alternatively, set the token as an environment variable:

export ZALO_BOT_TOKEN="12345689:abc-xyz"

Step 4: Restart and Pair

  1. Restart your Openclaw Gateway to apply the changes:
    Openclaw gateway restart
  2. Send a Direct Message to your Zalo bot from the Zalo app.
  3. By default, the bot uses pairing mode and will reply with a pairing code.
  4. Approve the connection in your Openclaw terminal:
    Openclaw devices approve <requestId>
Zalo Personal Integration

Configuration Options

DM Policy Settings

The dmPolicy controls how direct messages are handled:

  • pairing: Users must pair before chatting (recommended)
  • allowlist: Only specific user IDs can message the bot
  • open: Anyone can message without restrictions

Example with Allowlist

{
"channels": {
"zalo": {
"enabled": true,
"botToken": "${ZALO_BOT_TOKEN}",
"dmPolicy": "allowlist",
"allowFrom": ["user_id_1", "user_id_2"]
}
}
}

Testing Your Setup

Send a test message to your Zalo bot. You should receive an AI-generated response within seconds. Check the Gateway logs if messages aren't going through:

Openclaw gateway --verbose

Troubleshooting & Best Practices

IssueSolution
Bot not respondingVerify the bot token is correct and the Gateway is running
Pairing code not receivedCheck that dmPolicy is set to pairing
Messages delayedEnsure your Gateway host has stable internet connectivity
Token expiredRegenerate the bot token from Zalo Bot Platform

Security Tip: Always use environment variables for tokens in production instead of hardcoding them in config files. For related messaging integrations, check out our guides on BlueBubbles Openclaw and Telegram Openclaw setup.

Your Openclaw agent is now ready to chat with Zalo users. The pairing system ensures only authorized users can interact with your AI, keeping your deployment secure.