As far as I can tell, if a tweet links to a twitter card, the only way I can discover that is by parsing the
expanded_url contained in the
urls in the tweet data and seeing if “cards.twitter.com” is in the domain of the expanded_url. (Correct me if I’m wrong!)
Those are clickable URLs though. I think I can parse out the card ID from the URL, but it seems in the ads API there are separate endpoints for fetching each type of card. Eg. for an app download card it would be
GET accounts/:account_id/cards/app_download/:card_id as described at https://dev.twitter.com/ads/reference/get/accounts/%3Aaccount_id/cards/app_download/%3Acard_id
So if I have a tweet, and I want to construct a request to the right ads API endpoint to fetch the card linked to by that tweet, how would I do that?