Marketing Campaigns
A campaign is any message sent to multiple recipients. While transactional messagesare 1:1 (one message to one recipient triggered by an event), campaigns are 1:many — one message delivered to a list of people or a contact group. Both use the same POST /v1/messages endpoint.
You can target campaigns by passing multiple phone numbers in toNumbers, contact group IDs in groupIds, or both together in the same request.
Send to a contact group
The most common approach. Create groups via the Contact Management API, then target them by ID.
curl --request POST \
--url https://a.eztexting.com/v1/messages \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--user 'your_username:your_password' \
--data '{
"groupIds": [
"987654"
],
"message": "Flash sale! 20% off all plans this weekend. Use code FLASH20 at checkout. Reply STOP to opt out.",
"messageType": "SMS",
"companyName": "Acme Co"
}'Send to a list of numbers
When your recipient list comes from an external system and you don't need to maintain contact groups in EZ Texting.
curl --request POST \
--url https://a.eztexting.com/v1/messages \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--user 'your_username:your_password' \
--data '{
"toNumbers": [
"15551234567",
"15559876543",
"15551112222"
],
"message": "Your table is ready! Head to the host stand when you arrive.",
"messageType": "SMS",
"companyName": "Downtown Grill"
}'Message templates
Templates let you define reusable campaign content and reference it by ID when sending. Create a template once, then use it across multiple campaigns for consistent branding. Templates require name and message fields, and optionally accept companyName, mediaFileId, and mediaFileUrl.
curl --request POST \
--url https://a.eztexting.com/v1/message-templates \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--user 'your_username:your_password' \
--data '{
"name": "Weekly Newsletter",
"message": "This week at Acme Co: new features, tips, and a special offer just for subscribers. Details: https://example.com/newsletter",
"companyName": "Acme Co"
}'Scheduling
Include sendAt with an ISO 8601 timestamp to schedule a campaign. Omit it to send immediately. Cancel a scheduled campaign with DELETE /v1/messages before it sends. When scheduling for recipients across time zones, consider segmenting your audience into regional groups and scheduling each separately.
MMS campaigns
Set messageType to "MMS" and include media via mediaUrl or mediaFileId. For campaigns, pre-uploading media via POST /v1/media-filesis recommended — when sending to many recipients, an external URL that becomes temporarily unavailable could cause delivery failures.
Campaign reporting
After a campaign sends, use the reporting endpoints to measure performance.
curl --request GET \
--url https://a.eztexting.com/v1/message-reports/123456789 \
--header 'accept: application/json' \
--user 'your_username:your_password'| Report endpoint | Returns |
|---|---|
GET /v1/message-reports/{id} | Overall delivery summary (sent, delivered, failed, pending) |
.../responses/delivery | Per-recipient delivery statuses |
.../responses/engagement | Opt-out events and engagement metrics |
.../responses/link | Per-link click data |
Consent and compliance
- Recipients must have explicitly opted in to receive promotional messages
- Honor opt-outs immediately — STOP is processed automatically by EZ Texting
- Include your
companyNameso recipients know who the message is from - Include opt-out instructions in your first message to new subscribers
- Respect quiet hours (typically 8 AM–9 PM in the recipient's time zone)
Error handling
| Status | Meaning | What to do |
|---|---|---|
400 | Bad Request | Check required fields. Verify phone number format. Ensure toNumbers and groupIds aren't both present. |
401 | Unauthorized | Credentials invalid or token expired. Refresh your token. |
404 | Not Found | The message ID, group ID, or keyword doesn't exist. |
422 | Unprocessable | A group has no contacts, or all numbers are opted out. |
429 | Rate Limited | 200 req/min exceeded. Wait for X-Rate-Limit-Retry-After-Milliseconds header value. |
500 | Server Error | Retry with exponential backoff. Contact support if it persists. |
Next steps
- Transactional Messaging — Send 1:1 event-driven messages
- Contact Management — Build and organize the groups your campaigns target
- Conversational Messaging — Manage replies from campaign recipients
- Automations — Grow your list with keywords and automate follow-ups
- API Reference — Full interactive endpoint documentation