Developer Documentation

Complete API documentation for integrating SMS Campaign services into your applications.

Authentication

Getting Your API Token

All API requests require authentication using Bearer tokens which are created after login the dashboard. Here's how to create a token the web platform: API Tokens->Create

Quick Start

1

Get Your Token

Authenticate with your credentials to receive an API token.

2

Create Campaign

Create an SMS campaign with your message and contacts.

3

Send SMS

Created campaigns are automatically send

4

Track Results

Success message is returned with each contact having its send status

API Endpoints

POST http://smspop.co.zw/api/campaigns
Create & Send Campaign

Create a new SMS campaign. SMS will be sent automatically.

Request Body

{
  "name": "Welcome Campaign",
  "message": "Hello, welcome to our service!",
  "sender_id": "BRAND1",
  "contact_import_method":"manual",
  "manual_contacts": "263771234567, 263772345678",
}

Response

{
  "success": true,
  "message": "Successfully imported 2 contacts and SMS sending completed.",
  "campaign":{"name":"Test Campaign Manual","message":"Test sms2","sender_id":"SMSPoe","status":"approved"}, ,
  "summary": { "sent": 2, "failed": 0 },
  "contacts":[{"phone_number":"263776137000","status":"sent"},{"phone_number":"263776137222","status":"sent"}]},
}
GET http://smspop.co.zw/api/campaigns
List Campaigns

Retrieve all campaigns for the authenticated user.

Code Examples

JavaScript/Node.js

async function createAndSendCampaign() {
    Create and send campaign
    const campaignResponse = await fetch('http://smspop.co.zw/api/campaigns', {
        method: 'POST',
        headers: {
            'Authorization': `Bearer ${token}`,
            'Content-Type': 'application/json',
        },
        body: JSON.stringify({
            name: 'Welcome Campaign',
            message: 'Hello! Welcome to our service.',
            sender_id: 'BRAND1',
            "contact_import_method":"manual",
            manual_contacts: '263771234567, 263772345678',
        })
    });

    const result = await campaignResponse.json();
    console.log(result);
}

createAndSendCampaign();

PHP

<?php
Create and send campaign
$campaignData = [
    'name' => 'Welcome Campaign',
    'message' => 'Hello! Welcome to our service.',
    'sender_id' => 'BRAND1',
    "contact_import_method":"manual",
    'manual_contacts' => '263771234567, 263772345678',
];

$ch = curl_init('http://smspop.co.zw/api/campaigns');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($campaignData));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'Authorization: Bearer ' . $token
]);

$response = curl_exec($ch);
$result = json_decode($response, true);

print_r($result);
?>

Python

import requests
import json

Create and send campaign
campaign_url = "http://smspop.co.zw/api/campaigns"
campaign_data = {
    "name": "Welcome Campaign",
    "message": "Hello! Welcome to our service.",
    "sender_id": "BRAND1",
    "contact_import_method":"manual",
    "manual_contacts": "263771234567, 263772345678",
}

headers = {
    "Authorization": f"Bearer {token}",
    "Content-Type": "application/json"
}

response = requests.post(campaign_url, json=campaign_data, headers=headers)
result = response.json()

print(json.dumps(result, indent=2))

Error Handling

Common Error Responses

401

Unauthorized

Invalid or missing authentication token.

402

Insufficient Credit

{"success":false,"message":"Insufficient credits. Please purchase more SMS credits"}

Not enough SMS credits to send the campaign.

422

Invalid Sender ID

{"success":false,"message":"Invalid sender ID"}

Invalid sender IDprovided for the campaign.

403

Inactive Account

{"success":false,"message":"Your account is inactive. Please contact support."}

Account is in the error disabled mode. Contact support.

403

Forbidden

{"success":false,"message":"Campaign rejected: Content classified as political is not allowed"}

Campaign rejected due to content classification or user inactive. Category is displayed e.g. political

422

Validation Error

{"success":false,"message":"Validation failed","errors":{"contact_import_method":["The contact import method field is required."]}}

Invalid request data or missing required fields.

Need Help?

Our support team is here to help you integrate our API successfully.