Skip to content

Create Contact Audience

Tool name: create-contact-audience

Saves a contact audience, as "Save as audience" on the contact search page does: a named search over channel, subscription status, bounces, opt-in and confirmation dates, tags and custom field values. It is dynamic -- a newsletter addressing it (update-newsletter-draft, mode "saved_audience") reaches whoever matches when it is sent. Tags come from search-tags, fields and their types from search-custom-fields. The answer counts the contacts that match now. Sends nothing.

Input schema

namestring, [ 1 .. 250 ] charactersrequired

Name, unique within the account's audiences, at most 250 characters

filterobjectrequired
accountIdnull or integer, >= 1

User ID of the account; omit for the account of the access token

Default:null
Input example
{ "name": "string", "filter": { "channel": "any", "email": { "address": { "operator": "is", "value": "string" }, "statuses": [ "subscribed" ], "bounces": [ "not-bounced" ], "optInDate": { "operator": "on", "date": "string", "until": "string" }, "confirmationDate": { "operator": "on", "date": "string", "until": "string" } }, "sms": { "phoneNumber": { "operator": "is", "value": "string" }, "statuses": [ "subscribed" ], "bounces": [ "not-bounced" ], "subscriptionDate": { "operator": "on", "date": "string", "until": "string" } }, "tags": { "include": [ 1 ], "includeMatch": "all", "exclude": [ 1 ], "excludeMatch": "all" }, "customFields": [ { "fieldId": "string", "operator": "is-empty", "value": "string", "values": [ "string" ], "until": "string" } ] }, "accountId": null }

Output schema

accountIdintegerrequired
audienceIdintegerrequired
namestringrequired
filterobjectrequired
contactCountinteger or nullrequired
unsentNewslettersArray of objectsrequired
Output example
{ "accountId": 0, "audienceId": 0, "name": "string", "filter": { "channel": "any", "email": { "address": { "operator": "is", "value": "string" }, "statuses": [ "subscribed" ], "bounces": [ "not-bounced" ], "optInDate": { "operator": "on", "date": "string", "until": "string" }, "confirmationDate": { "operator": "on", "date": "string", "until": "string" } }, "sms": { "phoneNumber": { "operator": "is", "value": "string" }, "statuses": [ "subscribed" ], "bounces": [ "not-bounced" ], "subscriptionDate": { "operator": "on", "date": "string", "until": "string" } }, "tags": { "include": [ 1 ], "includeMatch": "all", "exclude": [ 1 ], "excludeMatch": "all" }, "customFields": [ { "fieldId": "string", "operator": "is-empty", "value": "string", "values": [ "string" ], "until": "string" } ] }, "contactCount": 0, "unsentNewsletters": [ { "newsletterId": 0, "name": "string", "channel": "email", "status": "draft" } ] }