CampaignRpc
This endpoint group provides RPC methods for managing campaigns, including listing, creating, updating, deleting, scheduling, launching, cancelling, and resolving reference data for campaign-related forms.
Endpoints
POST /api/rpc (Method: CampaignRpc.getData)
Description: Returns campaign data using the provided filter, sort, and pagination options.
Request Body:
{ "method": "CampaignRpc.getData", "params": { "filter": {}, "sort": {}, "page": 1, "pageSize": 20 } }Parameters:
Name Type Required Description filterAnyNo Optional query filter passed through to the campaign service. sortAnyNo Optional sort specification passed through to the campaign service. pageNumberNo Optional page number for paginated results. pageSizeNumberNo Optional page size for paginated results. Response:
{ "success": true, "data": { "..." } }The exact response shape is determined by
CampaignService.getCampaigns(...).Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "CampaignRpc.getData", "params": { "filter": {}, "sort": {}, "page": 1, "pageSize": 20 } }'
POST /api/rpc (Method: CampaignRpc.create)
Description: Creates a new campaign.
Request Body:
{ "method": "CampaignRpc.create", "params": { "name": "Spring Campaign", "type": "message", "audienceId": "audience-id", "templateId": "template-id", "channelConfigId": "channel-config-id", "brandingKitId": "branding-kit-id", "trackInInbox": true, "voiceOptions": { "workflowId": "workflow-id", "concurrency": 10, "retries": 0, "retryInterval": 60 }, "scheduleType": "now", "scheduledAt": null } }Parameters:
Name Type Required Description nameStringYes Campaign name. Must be a non-empty string. typeStringNo Campaign type. Allowed values are messageandvoice. Defaults tomessage.audienceIdStringNo Audience reference for message campaigns. May be omitted or null.templateIdStringNo Template reference for message campaigns. May be omitted or null.channelConfigIdStringNo Channel configuration reference for message campaigns. May be omitted or null.brandingKitIdStringNo Branding kit reference. May be omitted or null.trackInInboxBooleanNo Whether sent messages should create or update Unified Inbox conversations. Defaults to true.voiceOptionsObjectNo Optional voice campaign settings. When provided, workflowIdis required andconcurrency,retries, andretryIntervalhave schema defaults.scheduleTypeStringNo Scheduling mode. Allowed values are nowandlater. Defaults tonow.scheduledAtDateNo Optional scheduled execution time. scheduleIdStringNo Optional schedule task reference. statsObjectNo Not accepted by this method. The create schema omits stats._idStringNo Not accepted by this method. The create schema omits _id.subscriptionIdStringNo Not accepted by this method. The create schema omits subscriptionId.statusStringNo Not accepted by this method. The create schema omits status.Response:
{ "success": true, "data": { "..." } }The exact response shape is determined by
CampaignService.createCampaign(...).Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "CampaignRpc.create", "params": { "name": "Spring Campaign", "type": "message" } }'
POST /api/rpc (Method: CampaignRpc.update)
Description: Updates an existing campaign by
_id.Request Body:
{ "method": "CampaignRpc.update", "params": { "_id": "campaign-id", "name": "Updated Campaign Name" } }Parameters:
Name Type Required Description _idStringYes Campaign identifier. nameStringNo Campaign name. typeStringNo Campaign type. Allowed values are messageandvoice.audienceIdStringNo Audience reference. templateIdStringNo Template reference. channelConfigIdStringNo Channel configuration reference. brandingKitIdStringNo Branding kit reference. trackInInboxBooleanNo Whether message delivery should create or update Unified Inbox conversations. voiceOptionsObjectNo Optional voice campaign settings. statusStringNo Campaign status. Allowed values are draft,scheduled,running,completed,failed, andcancelled.scheduleTypeStringNo Scheduling mode. Allowed values are nowandlater.scheduledAtDateNo Scheduled execution time. scheduleIdStringNo Schedule task identifier. statsObjectNo Campaign statistics object when accepted by the underlying partial schema. createdAtDateNo Creation timestamp when accepted by the underlying partial schema. updatedAtDateNo Update timestamp when accepted by the underlying partial schema. Response:
{ "success": true, "data": { "..." } }The exact response shape is determined by
CampaignService.updateCampaign(...).Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "CampaignRpc.update", "params": { "_id": "campaign-id", "name": "Updated Campaign Name" } }'
POST /api/rpc (Method: CampaignRpc.delete)
Description: Deletes a campaign by
_id.Request Body:
{ "method": "CampaignRpc.delete", "params": { "_id": "campaign-id" } }Parameters:
Name Type Required Description _idStringYes Campaign identifier. Response:
{ "success": true, "data": { "..." } }The exact response shape is determined by
CampaignService.deleteCampaign(...).Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "CampaignRpc.delete", "params": { "_id": "campaign-id" } }'
POST /api/rpc (Method: CampaignRpc.launch)
Description: Launches a campaign. The decorator describes this method as intended for internal scheduler use.
Request Body:
{ "method": "CampaignRpc.launch", "params": { "campaignId": "campaign-id" } }Parameters:
Name Type Required Description campaignIdStringYes Campaign identifier. Response:
{ "success": true, "data": { "..." } }The exact response shape is determined by
CampaignService.launchCampaign(...).Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "CampaignRpc.launch", "params": { "campaignId": "campaign-id" } }'
POST /api/rpc (Method: CampaignRpc.schedule)
Description: Schedules a campaign that is currently in
draftorcancelledstate.Request Body:
{ "method": "CampaignRpc.schedule", "params": { "campaignId": "campaign-id" } }Parameters:
Name Type Required Description campaignIdStringYes Campaign identifier. Response:
{ "success": true, "data": { "..." } }The exact response shape is determined by
CampaignService.scheduleCampaign(...).Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "CampaignRpc.schedule", "params": { "campaignId": "campaign-id" } }'