Marketing API Version

CustomAudience

Fields

account_id, approximate_count, data_source, delivery_status, description, force_delete_lookalikes, id, lookalike_audience_ids, lookalike_spec, name, operation_status, opt_out_link, origin_audience_id, permission_for_actions, pixel_id, prefill, retention_days, rule, subtype, time_updated

CustomAudience.add_users (schema, users, is_raw, app_ids, pre_hashed)

Adds users to this CustomAudience.

Args: schema: A CustomAudience.Schema value specifying the type of values in the users list. users: A list of identities respecting the schema specified.

Returns: The FacebookResponse object.

Name Type Description Required

schema

string

Specify whether you are adding users using email, user IDs, or phone numbers.

Yes

users

array

An array of user IDs.

Yes

is_raw

boolean

Whether the data is raw or escaped.

No

app_ids

array

An array of application IDs.

No

pre_hashed

boolean

Whether or not the data has already been hashed. If not, the SDK will automatically hash the data.

No

Sample Code

custom_audience = CustomAudience('6040236453040')
response = custom_audience.add_users(
    schema=CustomAudience.Schema.email_hash,
    users=[
        'joe@example.com',
    ]
)
print response

CustomAudience.format_params (schema, users, is_raw, app_ids, pre_hashed)

Name Type Description Required

schema

string

Specify whether you are adding users using email, user IDs, or phone numbers.

Yes

users

array

An array of user IDs.

Yes

is_raw

boolean

Whether the data is raw or escaped.

No

app_ids

array

An array of application IDs.

No

pre_hashed

boolean

Whether or not the data has already been hashed. If not, the SDK will automatically hash the data.

No

Sample Code

formatted_params = CustomAudience.format_params(
    schema=CustomAudience.Schema.email_hash,
    users=['joe@example.com'],
)
print formatted_params

CustomAudience.remove_users (schema, users, is_raw, app_ids, pre_hashed)

Deletes users from this CustomAudience.

Args: schema: A CustomAudience.Schema value specifying the type of values in the users list. users: A list of identities respecting the schema specified.

Returns: The FacebookResponse object.

Name Type Description Required

schema

string

Specify whether you are adding users using email, user IDs, or phone numbers.

Yes

users

array

An array of user IDs.

Yes

is_raw

boolean

Whether the data is raw or escaped.

No

app_ids

array

An array of application IDs.

No

pre_hashed

boolean

Whether or not the data has already been hashed. If not, the SDK will automatically hash the data.

No

Sample Code

custom_audience = CustomAudience('6040236453040')
response = custom_audience.remove_users(
    schema=CustomAudience.Schema.email_hash,
    users=[
        'joe@example.com',
    ]
)
print response