Services Integrated:
- ✅ Infobip (WhatsApp + SMS)
- ✅ Slack (Team collaboration)
- ✅ OpenAI Whisper (Speech-to-Text)
- ✅ 11Labs (Text-to-Speech)
- ✅ Asterisk SIP (Voice calls)
- ✅ RAG System (Document Q&A)
- ✅ GPT-OSS via Hugging Face
Infobip Account:
- Sign up at https://www.infobip.com
- Get API key from portal
- Configure WhatsApp sender number
- Note your base URL (usually https://api.infobip.com)
Slack App:
- Create app at https://api.slack.com/apps
- Add bot token scopes:
app_mentions:read,chat:write,files:read - Enable events:
app_mention,message.channels - Install to workspace
OpenAI:
- Get API key from https://platform.openai.com/api-keys
- Used for Whisper speech-to-text
11Labs:
- Sign up at https://elevenlabs.io
- Get API key from settings
- Choose voice ID (default: Rachel)
Hugging Face:
- Get token from https://huggingface.co/settings/tokens
- Used for GPT-OSS model access
cd /home/admin/ragbot
# Install Python packages
pip install -r requirements.txt.new
# Install system dependencies
sudo apt-get update
sudo apt-get install -y ffmpeg asterisk
# Install Playwright browsers (for web scraping)
playwright install chromium# Copy new env template
cp .env.example.new .env
# Edit with your credentials
nano .envFill in:
# Infobip
INFOBIP_API_KEY=your_key_here
INFOBIP_WHATSAPP_NUMBER=447123456789
# Slack
SLACK_BOT_TOKEN=xoxb-...
SLACK_SIGNING_SECRET=...
# OpenAI
OPENAI_API_KEY=sk-...
# 11Labs
ELEVENLABS_API_KEY=...
# Hugging Face
HUGGINGFACE_API_TOKEN=hf_...Test Infobip:
python infobip_client.pyTest Voice Agent:
python voice_agent_v2.pyTest WhatsApp Bot:
python whatsapp_bot_infobip.pyEdit /etc/asterisk/extensions.conf:
[voice-agent]
; Incoming call handler
exten => 1000,1,Answer()
same => n,Wait(1)
same => n,Playback(welcome)
same => n,Set(UNIQUEID=${UNIQUEID})
same => n,Record(/var/spool/asterisk/recording/${UNIQUEID}.wav,3,60,q)
same => n,AGI(voice_agent.py)
same => n,Playback(${response_audio})
same => n,Goto(1000,1)
same => n,Hangup()
; Alternative: Direct AI response
exten => 2000,1,Answer()
same => n,AGI(voice_agent_realtime.py)
same => n,Hangup()Edit /etc/asterisk/sip.conf:
[general]
context=default
allowguest=no
udpbindaddr=0.0.0.0
tcpenable=yes
tcpbindaddr=0.0.0.0
[your-sip-provider]
type=friend
host=sip.yourprovider.com
username=your_username
secret=your_password
context=voice-agent
dtmfmode=rfc2833
canreinvite=nocd /var/lib/asterisk/agi-bin
sudo nano voice_agent.pyPaste the AGI script from voice_agent_v2.py (it auto-generates)
sudo chmod +x /var/lib/asterisk/agi-bin/voice_agent.pysudo systemctl restart asterisk
sudo asterisk -rx "core reload"In Infobip portal:
- Go to Channels → WhatsApp
- Set webhook URL:
https://your-domain.com/whatsapp/webhook - Enable: Message Received, Delivery Report
In Slack app settings:
- Enable Event Subscriptions
- Request URL:
https://your-domain.com/slack/events - Subscribe to:
app_mention,message.channels
cd /home/admin/ragbot
python main.py# Use existing service
sudo systemctl restart ragbot.service
sudo systemctl status ragbot.service
# View logs
journalctl -u ragbot.service -fDial extension 1000 from any SIP client
- System answers: "Welcome to HeySalad AI"
- You speak: "What's on the menu today?"
- System records your audio
- Whisper transcribes it
- RAG system processes query
- 11Labs synthesizes response
- System plays back audio
tail -f /var/log/asterisk/full
tail -f logs/ragbot.logcurl -X POST "https://api.infobip.com/whatsapp/1/message/text" \
-H "Authorization: App YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "YOUR_SENDER_NUMBER",
"to": "447123456789",
"content": {
"text": "Hello from HeySalad!"
}
}'Send a WhatsApp message to your number, check logs:
tail -f logs/ragbot.log | grep "whatsapp"- Mention your bot in a channel:
@ragbot hello - Upload a document and mention bot
- Check bot responds in thread
# Test API connectivity
curl -H "Authorization: App YOUR_KEY" \
https://api.infobip.com/whatsapp/1/senders
# Check webhook is reachable
curl https://your-domain.com/health# Check permissions
sudo chown -R asterisk:asterisk /var/spool/asterisk/recording
sudo chmod 755 /var/spool/asterisk/recording
# Test recording manually
asterisk -rx "core show channels"# Install proper audio codecs
sudo apt-get install asterisk-core-sounds-en-wav
sudo apt-get install asterisk-moh-opsound-wav
# Check FFmpeg installed
ffmpeg -version- Check usage at https://elevenlabs.io/usage
- Upgrade plan or use alternative TTS
- Implement caching for common responses
# Application logs
tail -f logs/ragbot.log
# Asterisk logs
tail -f /var/log/asterisk/full
# System logs
journalctl -u ragbot.service -f
# Check service status
curl http://localhost:8000/health- Environment Variables: Never commit
.envto git - Webhook Validation: Validate Infobip webhook signatures
- API Keys: Rotate regularly
- Firewall: Restrict Asterisk SIP ports
- HTTPS: Always use SSL for webhooks
- Handles: 10-50 concurrent users
- Voice calls: 2-3 simultaneous
- WhatsApp: 100+ messages/min
Option 1: Add More Raspberry Pis
- Use Nghttp2/HAProxy for load balancing
- Share ChromaDB via network storage
- Distribute by channel (one Pi per service)
Option 2: Cloud Hybrid
- Keep bots on Pi
- Move AI processing to cloud
- Use Redis for message queue
Option 3: Full Cloud Migration
- AWS ECS or Google Cloud Run
- Managed databases
- Auto-scaling enabled
- ✅ Get all API keys
- ✅ Configure
.envfile - ✅ Install dependencies
- ✅ Test each integration individually
- ✅ Configure Asterisk SIP
- ✅ Set up webhooks
- ✅ Run production service
- ✅ Monitor and optimize
- GitHub Issues: [Your repo]
- Email: peter@saladhr.com
- Slack: [Your workspace]
Built with ❤️ for HeySalad Powered by Infobip, OpenAI, 11Labs, and Asterisk