facebook / facebook-ruby-business-sdk

Ruby SDK for Meta Marketing API
https://developers.facebook.com/docs/business-sdk
Other
208 stars 161 forks source link

removing users from custom audience is throwing error ''Data is missing or does not match schema:" #63

Closed anudeepreddyg closed 4 years ago

anudeepreddyg commented 5 years ago

removing users from custom audience is throwing error ''Data is missing or does not match schema:"

I am using

ca = FacebookAds::CustomAudience.get(, { access_token: , app_secret: }) users = [['FirstName', 'test1@example.com', 'LastName1'], ['FirstNameTest', 'test2@example.com', 'LastNameTest']]

schema = ["FN","EMAIL","LN"]

ca.remove_user(users, schema)

When I execute above code I am getting error-- (#100) Data is missing or does not match schema:

mtam2 commented 5 years ago

As far as I can tell, you can only remove users by email. So only

emails = [ ['test1@example.com'], ['test2@example.com'] ]
schema = ['EMAIL']
ca.remove_user(emails, schema)
guruprasad83 commented 4 years ago

@mtam2 @anudeepreddyg - I am also getting the error when deleting the users from audience. But for me the error says OAuth "Facebook Platform" "invalid_request" "Permissions error" I had validated my token from here - https://developers.facebook.com/tools/debug and it seems all the permission sets, scopes are proper. Any help on this would be greatly appreciated.

stale[bot] commented 4 years ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 years ago

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

al13bash commented 4 years ago

Having same issue here. I'm doing custom_audience.users.destroy({ payload: payload }) and getting FacebookAds::ClientError ((#100) Data is missing or does not match schema: (fbtrace_id: AAvLiebehl7JhmxoiC6UY2T)). Same payload works fine for custom_audience.users.create({ payload: payload }).

mtam2 commented 4 years ago

@al13bash fb_audience.remove_user(array_of_emails, ["EMAIL"]) https://github.com/facebook/facebook-ruby-business-sdk/blob/master/lib/facebook_ads/ad_objects/helpers/custom_audience_helpers.rb#L57 Sometimes the remove schema is incompatible so I cut it down to the bare minimum email. I can't find any documentation for it so you'll have to keep guessing what the schema is unfortunately. https://developers.facebook.com/docs/marketing-api/audiences/guides/custom-audiences#remove

guruprasad83 commented 4 years ago

Just in case if it would be helpful for someone, Actually the delete API has some constraint and for us it did not worked and was getting error OAuth "Facebook Platform" "invalid_request" "Permissions error" Even though our token validation and all were proper. But digging more, we came to know that it was actually because of Audience size. If the audience size is lesser in size (not sure may be 100) it wont delete the users and throws error. We came to know this error only when we use facebook developer platform to tried the same delete request and got the error.