Remove contacts from the audience

SDK platic.campaigns.audience.remove()
SDK platic.campaigns.audience.removeMany()

Remove contacts whose phoneNumber matches the supplied phone number from the audience.

Example

// Remove one
await platic.campaigns.audience.remove("campaign_123", "5215512345678");

// Remove several
const result = await platic.campaigns.audience.removeMany("campaign_123", { phoneNumbers: ["5215512345678"] });

Path parameters

ParameterTypeDescriptionRequirement
campaignIdstringUnique identifier of the campaignrequired
phoneNumberstringPhone number of the contact to remove, with country code and without symbolsrequired

Response 200 OK

{
  "status": "success",
  "message": "Client removed from campaign successfully",
  "data": {
    "success": true,
    "message": "Client removed from campaign successfully",
    "removedCount": 1
  }
}

Notes

  • The contact stays in the workspace; only the campaign tag is removed.
  • If no contact exists with that phoneNumber, the endpoint answers 200 with removedCount: 0
  • If several contacts have the same phoneNumber, the campaign tag is removed from all of them

Remove several at once

Remove from the audience all the results of a contact search, a list of ids, or a list of phones. The contacts stay in the workspace.

{ "phoneNumbers": ["5215512345678", "5215587654321"] }

Send exactly one of these:

ParameterTypeDescription
searchIdstringThe searchId of a search: removes all its results. With topN, only the first N
clientIdsstring[]Contact ids, up to 5,000
phoneNumbersstring[]Phones with country code, up to 5,000
{
  "status": "success",
  "message": "2 contacts were removed from the audience",
  "data": {
    "target": "phones",
    "message": "2 contacts were removed from the audience",
    "removed": 2
  }
}

target is search, client_ids, or phones. removed, notFound, and invalidPhoneCount arrive when Platica reports them.