Marketing Campaigns
Run targeted SMS and WhatsApp campaigns to drive sales, re-engagement, and awareness — while staying compliant with consent and quiet-hour rules across African markets. This guide walks through a full promotional campaign with segmentation, personalization, opt-out handling, and analytics.
Scenario: Weekend Flash Sale
A fashion retailer operating in Kenya, Nigeria, and Ghana wants to send a personalized flash-sale offer to 50,000 opted-in customers, segmented by country, with full opt-out compliance and post-campaign reporting.
Step 1: Build a Consented Audience
Only message contacts who opted in. AfriRoute enforces this at send time, but you should segment up front:
def build_audience(contacts):
"""Keep only marketing-consented contacts, grouped by country."""
audience = {}
for c in contacts:
if not c.get('marketing_consent'):
continue
audience.setdefault(c['country'], []).append(c)
return audience
Step 2: Launch a Campaign
Use the campaigns endpoint to send personalized, throttled, country-aware traffic in one call:
curl -X POST https://api.afriroute.ai/api/v1/campaigns \
-H "Authorization: Bearer $AFRIROUTE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Weekend Flash Sale",
"from": "StyleHub",
"category": "promotional",
"respect_quiet_hours": true,
"message_template": "Hi {{name}}, weekend flash sale! {{discount}}% off everything. Shop: {{link}} Reply STOP to opt out.",
"recipients": [
{ "to": "+254712345678", "vars": { "name": "Amina", "discount": "30", "link": "stylehub.co/ke" } },
{ "to": "+2348012345678", "vars": { "name": "Chidi", "discount": "25", "link": "stylehub.co/ng" } }
]
}'
{ "campaign_id": "camp_abc123", "total_recipients": 2, "status": "scheduled", "estimated_cost": 0.0218, "currency": "USD" }
Step 3: Respect Quiet Hours and Opt-Outs
With respect_quiet_hours: true, promotional messages submitted during a country's restricted window are held and released at the next permitted hour (see Country Requirements). The Reply STOP to opt out footer is mandatory for promotional traffic — AfriRoute auto-suppresses anyone who replies STOP:
curl https://api.afriroute.ai/api/v1/contacts/suppressions \
-H "Authorization: Bearer $AFRIROUTE_API_KEY"
Step 4: Measure Results
Pull campaign analytics once delivery completes:
curl https://api.afriroute.ai/api/v1/campaigns/camp_abc123/analytics \
-H "Authorization: Bearer $AFRIROUTE_API_KEY"
{
"sent": 50000,
"delivered": 48650,
"failed": 1350,
"delivery_rate": 0.973,
"opt_outs": 142,
"link_clicks": 9120,
"total_cost": 543.20,
"currency": "USD"
}
Compliance Checklist
- ✅ Marketing opt-in consent recorded for every recipient — see Data Protection
- ✅ EU recipients handled under GDPR
- ✅ Mandatory STOP opt-out in every message
- ✅ Quiet hours respected per country
- ✅ Registered promotional sender ID per market
Best Practices
- Personalize with name and locale-relevant offers — lifts conversion materially.
- Segment by country so links, currency, and language match.
- A/B test subject hooks on a small sample before full send.
- Estimate cost before launch using SMS Pricing.
- Throttle large sends; AfriRoute campaigns handle rate limiting for you.
Related
Last Updated: May 2026