Skip to content

RPA Campaigns (Bot Automation)

Mahadata provides a dedicated set of pages and API endpoints under /rpa/* designed for browser RPA tools (UiPath, Power Automate, Selenium, Playwright). RPA pages use simple HTML widgets without virtual comboboxes, autocomplete, or asynchronous dropdowns — every interactive element has a stable data-testid that is stable.

  • Not a replacement for the human campaign portal. The /campaigns/* portal keeps evolving; the RPA surface only covers a small stable subset.
  • Not a scheduling interface. Campaigns that are sent have a DRAFT status. The bot schedules via standard endpoints POST /api/campaigns/{id}/schedules.
  • Not a multi-tenant aggregator. The bot authenticates as a single user belonging to one tenant via standard JWT cookies.

To send an SMS campaign to a new audience:

  1. Login. POST to /auth/login (or use the standard portal login form). Save the cookie access_token.
  2. Upload the audience. multipart POST form to /api/v1/rpa/audiences with name (string) and csv (file). Receive a response containing { audience_id, processing_status, result_url, status_url }.
  3. Receive a response containing GET status_url up to processing_status == "ready". Recommended polling interval: 2 seconds, maximum timeout: 60 seconds.
  4. Send campaign. POST JSON to /api/v1/rpa/campaigns.
  5. (Optional) Schedule it. POST to the standard endpoint /api/campaigns/{campaign_id}/schedules.
RouteMethodPurpose
/rpa/audiences/newGET / POSTAudience upload form
/rpa/audiences/{id}/resultGETAudience status page (polling)
/rpa/campaigns/newGET / POSTCampaign dispatch form (all channels)
/rpa/campaigns/{id}/resultGETCampaign status page (polling)
/api/v1/rpa/audiencesPOSTAudience upload API (multipart)
/api/v1/rpa/campaignsPOSTCampaign creation API (JSON)

All routes /rpa/* require a cookie access_token that is valid.

Request: Content-Type: multipart/form-data

ColumnTypeRequiredDescription
namestringyesAudience display name. Does not have to be unique, but the same name will result in an error AMBIGUOUS at resolution.
csvfileyesCSV with a header row containing the columns phone_number. The delimiter is auto-detected (,, ;, or tab).

Success response (HTTP 201):

{
"audience_id": "550e8400-e29b-41d4-a716-446655440000",
"processing_status": "processing",
"result_url": "/rpa/audiences/550e8400-e29b-41d4-a716-446655440000/result",
"status_url": "/api/audiences/550e8400-e29b-41d4-a716-446655440000"
}

Request: Content-Type: application/json

The columnTypeRequiredDescription
namestringyesCampaign name
audiencestringyesName or UUID of the audience
channelstringyes"sms", "whatsapp", or "rbm"
{
"name": "Promo bulan ini",
"audience": "Daftar kontak Q2",
"channel": "sms",
"sms_sender": "MAHADATA",
"sms_channel": 0,
"sms_body": "Halo {{1}}, dapatkan diskon spesial hari ini!"
}
ColumnTypeRequiredDescription
sms_senderstringyesName or UUID of the SMS sender
sms_channelintyes0=Normal, 1=Alert, 2=OTP
sms_bodystringyesGSM-7, max 580 septets, may contain {{1}}
The columnTypeRequiredDescription
wabastringyesMeta WABA ID (from Meta Business Manager)
phone_number_idstringyesMeta Phone Number ID (not the phone number)
templatestringyesTemplate name or UUID
variables_jsonstringconditionalJSON mapping variable positions to audience CSV columns
The columnTypeRequiredDescription
rbm_agentstringyesRCS agent name or UUID
sms_failover_bodystringnotSMS fallback content if RCS delivery fails

The campaign endpoint combines create → activate → schedule/run in a single bot turn.

Default if no schedule field is included. The server activates and runs the campaign immediately. Response: schedule_status: "sent".

Mutually exclusive: schedule_at and schedule_cron cannot both be included.

CronTimezoneMeaning
0 9 * * MONAsia/JakartaEvery Monday at 9 AM WIB
0 9 1 * *UTCThe 1st of every month at 9 UTC
*/30 * * * *UTCEvery 30 minutes
0 0 * * SUNAmerica/New_YorkMidnight every Sunday New York time

If the tenant enables maker-checker, RPA submissions enter the approval queue:

  1. RPA response returns status: "DRAFT" and schedule_status: "pending_approval".
  2. A human checker (or a separate bot with the Checker role) approves via the approval queue UI.
  3. Once approved, the status changes to ACTIVE.
CodeMeaningBot Actions
REQUIREDRequired field is emptyFill in the field
UNKNOWNName does not match any resourceCheck the spelling; use a UUID
AMBIGUOUSName matches more than 1 resourceUse a UUID
WRONG_TENANTUUID belongs to another tenantUse a resource that belongs to your tenant
INACTIVEResource exists but is paused/rejectedWait or choose another one
INVALID_GSM7SMS content contains non-GSM-7 charactersRemove the characters; common causes: emoji, smart quotes
OUT_OF_RANGEsms_channel is not 0, 1, or 2Use 0, 1, or 2
INVALID_JSONvariables_json cannot be parsedFix the JSON syntax
UNKNOWN_COLUMNvariables_json maps a variable to a column that does not exist in the audience CSVUse a header column name that actually exists in the CSV
INVALID_CHANNELChannel is not sms/whatsapp/rbmUse one of the three
MUTUALLY_EXCLUSIVEschedule_at and schedule_cron both includedChoose only one
IN_THE_PASTschedule_at more than 60 seconds in the pastUse a future timestamp
INVALID_TIMESTAMPschedule_at not valid ISO 8601Use ISO 8601 with a timezone offset, e.g. 2026-06-15T09:00:00Z
INVALID_TIMEZONETimezone is not a valid IANA nameUse names like Asia/Jakarta, UTC