How to Send an AI Welcome Message When Someone Opens Your Viber Bot
Handle the conversation_started event so new Viber users get an AI-generated greeting instantly.
First impressions matter. Viber fires a conversation_started event the moment a user opens your bot, before they type anything. Replying in that window with a friendly, on-brand greeting boosts subscription rates. Here you will craft that greeting with AI and return it the way Viber expects.
What you need
- A working Viber bot with a set webhook (see the Viber bot guide)
- The
conversation_startedevent in your event_types list - Node 18+ and an AI API key
Step 1: Add the event to your webhook
Re-run set_webhook with conversation_started added so Viber notifies you when a user opens the chat.
Step 2: Generate and return the greeting
When the event type is conversation_started, ask the model for a short welcome that fits your brand, then send it back directly in res.json. Use the user's name from the payload to make it personal.
app.post("/viber", async (req, res) => {
if (req.body.event === "conversation_started") {
const name = req.body.user?.name || "there";
const out = await ai.chat.completions.create({
model: "gpt-5-mini",
messages: [
{
role: "system",
content:
"Write a one sentence warm welcome for a support bot. Address the user by name.",
},
{ role: "user", content: `The user is named ${name}.` },
],
});
return res.json({
type: "text",
text: out.choices[0].message.content,
});
}
res.sendStatus(200);
// ... handle "message" events as before
});Result
New users now get a personalized AI greeting the instant they open your bot, which nudges more of them to subscribe and start a real conversation.
Watch related tutorials
5:42
24:16
33:42
41:18
28:05
3:12