Kampanie SMS
Endpointy „Kampanie SMS” Zanfia Workspace API — ze schematami i przykładami kodu.
Jednorazowe wysyłki SMS do klientów zapisanych na SMS-y, realizowane przez Twojego połączonego dostawcę SMS (Twilio lub SMSAPI, Integracje → SMS). Kampanię tworzy się jako szkic i wysyła (lub planuje do 30 dni w przód) osobnym endpointem. Wysyłka jest prawdziwa i nieodwracalna, a każdą wiadomość rozlicza z Tobą Twój dostawca, więc przed wywołaniem sprawdź szkic i jego odbiorców. Odbiorcy to all-sms-subscribed albo zapisany segment, zawsze zawężony do klientów ze zgodą na marketing SMS i numerem telefonu (segment sprawdzony przez POST /segments/preview może się więc tylko zmniejszyć); zgodami zarządzisz hurtowo przez POST /clients/sms-subscription. Odmowy zawierają maszynowy kod error (not-sendable, incomplete, empty-audience, no-provider, …), a szczegóły są w message. Wszystkie endpointy wymagają nagłówka Authorization: Bearer — zobacz Uwierzytelnianie.
Lista kampanii SMS
/sms-campaignsAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Response Body
application/json
application/json
curl -X GET "https://example.com/sms-campaigns"{ "campaigns": [ { "id": "string", "name": "string", "body": "string", "optOutHint": "string", "provider": "twilio", "sender": "string", "status": "draft", "audience": { "type": "segment", "segmentId": "string" }, "recipientCount": 0, "scheduledAt": "string", "sendStartedAt": "string", "completedAt": "string", "failureReason": "string", "failureCode": "segment-missing", "stats": { "sent": 0, "failed": 0, "skippedInvalidNumber": 0, "segments": 0 }, "createdAt": "string", "updatedAt": "string" } ]}{ "error": "string", "message": "string"}Utwórz szkic kampanii SMS
/sms-campaignsAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Creates a DRAFT — nothing is texted. Everything beyond the name is optional at draft time.
Response Body
application/json
application/json
curl -X POST "https://example.com/sms-campaigns" \ -H "Content-Type: application/json" \ -d '{ "name": "string" }'{ "ok": true, "campaign": { "id": "string", "name": "string", "body": "string", "optOutHint": "string", "provider": "twilio", "sender": "string", "status": "draft", "audience": { "type": "segment", "segmentId": "string" }, "recipientCount": 0, "scheduledAt": "string", "sendStartedAt": "string", "completedAt": "string", "failureReason": "string", "failureCode": "segment-missing", "stats": { "sent": 0, "failed": 0, "skippedInvalidNumber": 0, "segments": 0 }, "createdAt": "string", "updatedAt": "string" }}{ "error": "string", "message": "string"}Pobierz kampanię SMS
/sms-campaigns/{campaignId}Authorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Campaign id
Response Body
application/json
application/json
curl -X GET "https://example.com/sms-campaigns/string"{ "campaign": { "id": "string", "name": "string", "body": "string", "optOutHint": "string", "provider": "twilio", "sender": "string", "status": "draft", "audience": { "type": "segment", "segmentId": "string" }, "recipientCount": 0, "scheduledAt": "string", "sendStartedAt": "string", "completedAt": "string", "failureReason": "string", "failureCode": "segment-missing", "stats": { "sent": 0, "failed": 0, "skippedInvalidNumber": 0, "segments": 0 }, "createdAt": "string", "updatedAt": "string" }}{ "error": "string", "message": "string"}Zaktualizuj szkic kampanii SMS
/sms-campaigns/{campaignId}Authorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Campaign id
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Drafts only — a campaign past draft is immutable except cancel.
Response Body
application/json
application/json
curl -X PATCH "https://example.com/sms-campaigns/string" \ -H "Content-Type: application/json" \ -d '{}'{ "ok": true, "campaign": { "id": "string", "name": "string", "body": "string", "optOutHint": "string", "provider": "twilio", "sender": "string", "status": "draft", "audience": { "type": "segment", "segmentId": "string" }, "recipientCount": 0, "scheduledAt": "string", "sendStartedAt": "string", "completedAt": "string", "failureReason": "string", "failureCode": "segment-missing", "stats": { "sent": 0, "failed": 0, "skippedInvalidNumber": 0, "segments": 0 }, "createdAt": "string", "updatedAt": "string" }}{ "error": "string", "message": "string"}Usuń kampanię SMS
/sms-campaigns/{campaignId}Authorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Campaign id
Response Body
application/json
application/json
curl -X DELETE "https://example.com/sms-campaigns/string"{ "ok": true}{ "error": "string", "message": "string"}Wyślij lub zaplanuj kampanię SMS
/sms-campaigns/{campaignId}/sendAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Campaign id
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
⚠️ REAL SEND: texts the campaign's resolved audience through the creator's OWN SMS provider (Twilio / SMSAPI) — every message is billed to the creator by that provider. Delivered messages cannot be recalled; the only recovery is POST /sms-campaigns/:campaignId/cancel, which stops REMAINING sends. Omit scheduledAt to send immediately.
Response Body
application/json
application/json
curl -X POST "https://example.com/sms-campaigns/string/send" \ -H "Content-Type: application/json" \ -d '{}'{ "ok": true, "campaign": { "id": "string", "name": "string", "body": "string", "optOutHint": "string", "provider": "twilio", "sender": "string", "status": "draft", "audience": { "type": "segment", "segmentId": "string" }, "recipientCount": 0, "scheduledAt": "string", "sendStartedAt": "string", "completedAt": "string", "failureReason": "string", "failureCode": "segment-missing", "stats": { "sent": 0, "failed": 0, "skippedInvalidNumber": 0, "segments": 0 }, "createdAt": "string", "updatedAt": "string" }}{ "error": "string", "message": "string"}Anuluj zaplanowaną/wysyłaną kampanię SMS
/sms-campaigns/{campaignId}/cancelAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Campaign id
Response Body
application/json
application/json
curl -X POST "https://example.com/sms-campaigns/string/cancel"{ "ok": true, "campaign": { "id": "string", "name": "string", "body": "string", "optOutHint": "string", "provider": "twilio", "sender": "string", "status": "draft", "audience": { "type": "segment", "segmentId": "string" }, "recipientCount": 0, "scheduledAt": "string", "sendStartedAt": "string", "completedAt": "string", "failureReason": "string", "failureCode": "segment-missing", "stats": { "sent": 0, "failed": 0, "skippedInvalidNumber": 0, "segments": 0 }, "createdAt": "string", "updatedAt": "string" }}{ "error": "string", "message": "string"}Lista odbiorców kampanii SMS
/sms-campaigns/{campaignId}/recipientsAuthorization
bearerAuth API key from Dashboard → Integrations → API, MCP and CLI.
In: header
Path Parameters
Campaign id
Query Parameters
Value in
- "pending"
- "sent"
- "failed"
- "skipped-invalid-number"
1 <= value <= 20050The previous page's nextCursor (cursor is accepted as an alias).
Response Body
application/json
application/json
curl -X GET "https://example.com/sms-campaigns/string/recipients"{ "recipients": [ { "id": "string", "phoneNumber": "string", "firstName": "string", "lastName": "string", "status": "pending", "segments": 0, "statusDetails": "string", "problemCode": "segment-missing", "processedAt": "string" } ], "nextCursor": "string"}{ "error": "string", "message": "string"}Czy ten artykuł był pomocny?

