Skip to main content

Customer Support

Meet customers on the channels they already use. AfriRoute lets you run omnichannel support — two-way SMS, WhatsApp, and voice — through a single API, so a conversation that starts as an SMS reply can escalate to a WhatsApp thread or a callback without losing context. This guide shows how to build it.

Scenario: Two-Way Support Desk​

A utility company in Ghana wants customers to text a shortcode to report outages, get automated status replies, and escalate to a human agent or callback when needed.

Channels at a Glance​

ChannelBest forTwo-wayRich media
SMS (shortcode/long code)Quick queries, status checks✅❌
WhatsAppDetailed support, attachments✅✅
VoiceUrgent or complex issues✅❌

Step 1: Receive Inbound Messages​

Customers text your shortcode; AfriRoute delivers each message to your webhook:

inbound.js
app.post('/webhooks/inbound-sms', express.json(), async (req, res) => {
const { from, text, message_id } = req.body;
const intent = classify(text); // simple keyword or NLP routing

if (intent === 'outage') {
const status = await lookupOutage(from);
await reply(from, `We're aware of an outage in your area. Estimated fix: ${status.eta}.`);
} else if (intent === 'agent') {
await escalateToAgent(from, text);
await reply(from, 'Connecting you to an agent. Expect a reply within 10 minutes.');
} else {
await reply(from, 'Reply OUTAGE for status, BILL for balance, or AGENT to chat.');
}
res.sendStatus(200);
});

Step 2: Reply Helper​

reply.js
async function reply(to, message) {
await fetch('https://api.afriroute.ai/api/v1/sms/send', {
method: 'POST',
headers: { 'Authorization': 'Bearer $AFRIROUTE_API_KEY', 'Content-Type': 'application/json' },
body: JSON.stringify({ to, from: '40404', message, category: 'transactional' })
});
}

Step 3: Escalate to WhatsApp​

When a customer needs to send a photo (e.g. a damaged meter), move the thread to WhatsApp:

escalate.py
def open_whatsapp_thread(phone, ticket_id):
requests.post('https://api.afriroute.ai/api/v1/whatsapp/send',
headers={'Authorization': 'Bearer $AFRIROUTE_API_KEY'},
json={
'to': phone,
'template': 'support_escalation',
'parameters': [ticket_id],
'allow_media_reply': True
})

Step 4: Offer a Callback​

For urgent cases, trigger an outbound voice call that connects the customer to an agent:

curl -X POST https://api.afriroute.ai/api/v1/voice/call \
-H "Authorization: Bearer $AFRIROUTE_API_KEY" \
-d '{ "to": "+233241234567", "from": "+233302000000", "connect_to_agent_queue": "support_l2" }'

Step 5: Unified Conversation View​

Tag every message with a conversation_id so SMS, WhatsApp, and voice events for one customer roll up into a single ticket:

{ "conversation_id": "conv_ghana_4821", "channel": "sms", "direction": "inbound", "text": "No power since 2pm" }

Compliance Notes​

  • Support replies are transactional — no marketing opt-in needed, but log consent and PII lawfully (see Data Protection).
  • Use a registered shortcode for two-way SMS — see Sender ID Registration.

Best Practices​

  1. Auto-acknowledge every inbound message instantly.
  2. Publish keyword commands (OUTAGE, BILL, AGENT) so customers self-serve.
  3. Set expectations — tell customers how long until a human replies.
  4. Preserve context across channels with a shared conversation ID.
  5. Measure first-response and resolution times from message timestamps.

Last Updated: May 2026