text
stringlengths
0
59.1k
});
},
}),
logger,
voltOpsClient: new VoltOpsClient({
publicKey: process.env.VOLTAGENT_PUBLIC_KEY || "",
secretKey: process.env.VOLTAGENT_SECRET_KEY || "",
}),
});
```
**Key points:**
- `honoServer` provides lightweight HTTP handling for webhook integration
- `/webhook/whatsapp` handles both Meta verification and message processing
- `/health` endpoint enables uptime monitoring and load balancer checks
- VoltOps client integration for observability and debugging
- Custom server configuration allows WhatsApp-specific routing
- Async handlers support concurrent message processing
## Running the AI Agent
Once deployed, your AI agent handles natural conversations.
![agent-works](https://cdn.voltagent.dev/examples/with-whatsapp/agent-work.png)
Here are example interactions:
### Example Conversation 1: First-time Order
```
Customer: Hi
Agent: Welcome to our restaurant! πŸ• I'm here to help you order delicious food. Would you like to see our menu?
Customer: Yes please
Agent: Here's our menu:
**Pizza**
β€’ Margherita - Fresh tomatoes, mozzarella, basil ($12.99)
β€’ Pepperoni - Pepperoni, mozzarella, tomato sauce ($14.99)
**Burgers**
β€’ Classic Burger - Beef patty, lettuce, tomato, onion ($10.99)
β€’ Cheeseburger - Beef patty, cheese, lettuce, tomato ($11.99)
**Drinks**
β€’ Coke - Coca-Cola 330ml ($2.99)
β€’ Water - Mineral water 500ml ($1.99)
What would you like to order?
Customer: I'll have 2 pepperoni pizzas and a coke
Agent: Great choice! I've added:
- 2x Pepperoni Pizza ($29.98)
- 1x Coke ($2.99)
Your current total is $32.97. Would you like anything else?
Customer: No that's all
Agent: Perfect! Please provide your delivery address.
Customer: 123 Main Street, Apt 4B
Agent: Thank you! Order #1057 confirmed!
πŸ“ Delivery to: 123 Main Street, Apt 4B
πŸ’° Total: $32.97
⏰ Estimated delivery: 30-45 minutes
We'll notify you when your order is on the way!
```
### Example Conversation 2: Checking Order Status
```
Customer: What's the status of my order?
Agent: Let me check your recent orders...
I found your order #1057:
- Status: On the way πŸš—
- Total: $32.97
- Ordered: 15 minutes ago
Your order should arrive in about 15-30 minutes!
```
#### Next Steps
Now that you have a working WhatsApp order AI agent, consider these enhancements:
1. **Add payment integration**: Connect Stripe or PayPal for online payments
2. **Implement order tracking**: Real-time status updates via WhatsApp
3. **Multi-language support**: Detect and respond in customer's language
4. **Menu recommendations**: Use order history for personalized suggestions
5. **Voice note support**: Process audio messages for accessibility
6. **Admin dashboard**: Web interface for menu and order management
7. **Analytics**: Track popular items and peak ordering times
8. **Loyalty program**: Points and rewards for repeat customers
9. **Group ordering**: Handle multiple people ordering together
10. **Restaurant notifications**: Alert restaurant staff of new orders
<|endoftext|>