Hi,
I’m trying to use the API to create new audiences, and then update the audience from a list of emails.
I can successfully create a new audience via the API (POST to /accounts/{TwitterAccountId}/tailored_audiences), passing “name” parameter and “list_type” = EMAIL parameter. I get a CREATED status code back (and I can also see the audience via the website).
I take the “audienceId” from the data.id property in the response from creatnig the audience.
Next I POST a hashed list of email addresses to “/ton/bucket/ta_partner” - I get a CREATED status code in reponse, and I take the file location from the header “Location” parameter. I can then successfully GET this file from this endpoint https://ton.twitter.com/1.1/ton/bucket/ta_partner/{accountId}/{fileName} and it looks like the data I have uploaded.
Finally I POST to “/accounts/{TwitterAccountId}/tailored_audience_changes” and I get a CREATED staus code in reponse.
I am passsing the audienceId from the first request as the “tailored_audience_id” parameter, specifying “ADD” as “operation” parameter, passing the fileLocation from 2nd request as the “input_file_path” parameter. The response I get back has data.state property as “COMPLETED” which I am not expecting as I am uploading several thousand emails, and when I view the audience via the website it says “PROCESSING”.
If I query the endpoint https://ads-api.twitter.com/1/accounts/{accountId}/tailored_audience_changes then this also says that the update request has a state of “COMPLETED”.
I have waited several days, but the website interface still says “PROCESSING”, and the tailored_audience_changes endpoint still says “COMPLETED”.
All endpoints give me successful (CREATED) responses, and there are no errors or message that point to what is going wrong.
I have previously been able to create audiences and upload email files manually throught the website, and this has been successful.
My best guess is that the format of the file that I am uploading to the bucket is incorrect. But as far as I can tell I have followed all of the steps described in the correct format of “Tailored Audience File Data” here : https://dev.twitter.com/ads/audiences/file-data
I normalise each email address by lowercasing it , and trimming leading and trailing spaces.
I then hash the email address using SHA256, without a salt.
Then I stick a line feed ("\n") after each hashed email address, and join them all together. And I trim the final line feed.
This is the data that I POST to the “/ton/bucket/ta_partner” endpoint.
I have experimented with a number of changes to this file format , but none have worked so far:
I have tried using CRLF ("\r\n") instead of LF ("\n").
I have tried using unhashed email addresses.
I have tried not trimming the final LF from the end of the file.
Any help or pointers would be much appreciated. If you need any more information, or have any questions, please let me know.
Regards
Tim