Hi @anhtuan215
Process is really simple, but I know first time could be a little difficult to understand. Finally it isn’t different comared to Twitter Ads UI but abstracting some characteristics.
I hope if i divide the process in clear defined steps I can help you and other people that need the same solution.
First of all I should say that for Video Cards it’s a little different and I haven’t worked yet.
For the other ones.
How to associate a Twitter Ads Card to a Line Item
- Create your Website/App/Image App/ Lead Gen Card. As you usually do using your own images, titles and other properties that you need. Using the correct POST endpoint
- Retrieve from the response thet you get from the first point preview_url You should store this URL locally or in memory in order to use it later.
- Create a Tweet using https://ads-api.twitter.com/0/accounts/:account_id/tweet concatenating at the end previe_url we’ve get in previous point. Be carefull with the length of your tweet.
Note: I know that you can use organic tweets to promote them but I think is not the case we’re trying to solve.
- In this step we have a tweet susceptible to be a promoted tweet, and a line item without any tweet (
) with their respective Id’s, we’re going to call it tweet_id and line_item_id
- Create a Promoted Tweet using https://ads-api.twitter.com/0/accounts/:account_id/promoted_tweets providing both tweet_id and line_item_id (you can also send more than one tweet id.
Hopefully this will help you and more people!
Regards!