Skip to content

MailerEstimateCampaignRecipients

POST mailer/campaign/estimate-recipients

Counts how many recipients a filter would match, before anything is queued.

A warning before the rollout is cheaper than an investigation after it: a filter that accidentally matches the entire customer base is only obvious when the number is on screen.

Access Control

Allowed roles: admin, leader.

Request

POST https://{broker_domain}/mailer/campaign/estimate-recipients
{
  "recipientType": "CUSTOMER",
  "recipientConfig": {
    "filters": {
      "deskFilter": "DESK_EU*",
      "where": [["country_of_residence", "=", "UA"]]
    }
  }
}
{
  "command": "MailerEstimateCampaignRecipients",
  "extID": "1",
  "data": {
    "recipientType": "CUSTOMER",
    "recipientConfig": {
      "filters": {
        "deskFilter": "DESK_EU*",
        "where": [["country_of_residence", "=", "UA"]]
      }
    }
  }
}
const res = await platform.MailerEstimateCampaignRecipients({
  recipientType: "CUSTOMER",
  recipientConfig: {
    filters: {
      deskFilter: "DESK_EU*",
      where: [["country_of_residence", "=", "UA"]]
    }
  }
});

Request Data

Field Type Required Description
recipientType enum Yes CUSTOMER, LEAD, or MANAGER
recipientConfig object Yes { ids: [...] }, { filters: {...} }, or both. filters are platform filters: deskFilter plus where, orWhere, whereNot, whereIn, whereNotIn, whereBetween, whereNotBetween, orderBy

Response Data

limit is the configured campaign ceiling; exceedsLimit: true means the rollout would be refused.

byFilters is counted by the platform after the brand and desk scope of the caller is applied and before paging, so it is the size of the segment this caller would roll out. The rollout itself borrows the access of the campaign author, so a campaign created by someone with a wider desk scope can reach more recipients than this estimate shows.

{
  "recipientType": "CUSTOMER",
  "byIds": 0,
  "byFilters": 5400,
  "total": 5400,
  "limit": 20000,
  "exceedsLimit": false
}

Errors

Code Error Description
400 VALIDATION_ERROR Empty recipient config
400 INVALID_DATA The platform rejected the filter: unknown field or malformed condition
403 NOT_ENOUGH_RIGHTS The caller cannot see customers in the requested desk scope
500 PLATFORM_MANAGER_MISSING No manager to borrow platform access from: set [platform] managerId
503 PLATFORM_DISABLED The platform is switched off in the module config