Followers Targeting Call Issue / Ask


#1

When Auto Importing Targeting, call attached below, for natively created campaigns, for Followers targeting we are receiving the handle name and not the display names. Is there a way that through the API we can be sent the display name of the handle?

twurl -X GET -H ads-api.twitter.com “/1/accounts/18ce53vjzfs/targeting_criteria?line_item_id=7qxqh”

Example we are getting iamsrk when we would like to be receiving Shah Rukh Khan.

https://twitter.com/iamsrk?ref_src=twsrc^google|twcamp^serp|twgr^author

{“line_item_id”:“7qxqh”,“name”:“iamsrk”,“id”:“bzqgq0”,“account_id”:“18ce53vjzfs”,“created_at”:“2017-02-13T05:47:07Z”,“targeting_value”:101311381,“updated_at”:“2017-02-13T05:47:07Z”,“deleted”:false,“targeting_type”:“FOLLOWERS”}


#2

Hey @KowalityK

You can use the GET users/show endpoint to convert the @handle to a name. See the example below (for @iamsrk)

Request

twurl -H "api.twitter.com" -X GET "/1.1/users/show.json?screen_name=iamsrk" | jq .

Response

{
  "id": 101311381,
  "id_str": "101311381",
  "name": "Shah Rukh Khan",
  "screen_name": "iamsrk",
  "location": "",
  "profile_location": null,
  "description": "",
  "url": "http://t.co/rgTV59DRJ7",
  "entities": {
    "url": {
      "urls": [
        {
          "url": "http://t.co/rgTV59DRJ7",
          "expanded_url": "https://twitter.com/iamsrk",
          "display_url": "twitter.com/iamsrk",
          "indices": [
            0,
            22
          ]
        }
      ]
    },
    "description": {
      "urls": []
    }
  },
  "protected": false,
  "followers_count": 23457274,
  "friends_count": 81,
  "listed_count": 29392,
  "created_at": "Sat Jan 02 20:55:43 +0000 2010",
  "favourites_count": 13,
  "utc_offset": -32400,
  "time_zone": "Alaska",
  "geo_enabled": true,
  "verified": true,
  "statuses_count": 56246,
  "lang": "en",
  "status": {
    "created_at": "Tue Feb 21 20:18:14 +0000 2017",
    "id": 834135161356824600,
    "id_str": "834135161356824578",
    "text": "Hope u r well and thank u for the revisit. But I must say u do overstate the importance of Rajma Chawal.  https://t.co/qi5vX2zhRk",
    "truncated": false,
    "entities": {
      "hashtags": [],
      "symbols": [],
      "user_mentions": [],
      "urls": [
        {
          "url": "https://t.co/qi5vX2zhRk",
          "expanded_url": "https://twitter.com/Shakti_Shetty/status/833377356047798272",
          "display_url": "twitter.com/Shakti_Shetty/…",
          "indices": [
            106,
            129
          ]
        }
      ]
    },
    "source": "<a href=\"http://tapbots.com/tweetbot\" rel=\"nofollow\">Tweetbot for iΟS</a>",
    "in_reply_to_status_id": null,
    "in_reply_to_status_id_str": null,
    "in_reply_to_user_id": null,
    "in_reply_to_user_id_str": null,
    "in_reply_to_screen_name": null,
    "geo": null,
    "coordinates": null,
    "place": null,
    "contributors": null,
    "is_quote_status": true,
    "quoted_status_id": 833377356047798300,
    "quoted_status_id_str": "833377356047798272",
    "retweet_count": 422,
    "favorite_count": 1416,
    "favorited": false,
    "retweeted": false,
    "possibly_sensitive": false,
    "lang": "en"
  },
  "contributors_enabled": false,
  "is_translator": false,
  "is_translation_enabled": false,
  "profile_background_color": "022330",
  "profile_background_image_url": "http://pbs.twimg.com/profile_background_images/137435577/new1.jpg",
  "profile_background_image_url_https": "https://pbs.twimg.com/profile_background_images/137435577/new1.jpg",
  "profile_background_tile": true,
  "profile_image_url": "http://pbs.twimg.com/profile_images/661679664/keep_it_onn_normal.jpg",
  "profile_image_url_https": "https://pbs.twimg.com/profile_images/661679664/keep_it_onn_normal.jpg",
  "profile_banner_url": "https://pbs.twimg.com/profile_banners/101311381/1454256204",
  "profile_link_color": "0084B4",
  "profile_sidebar_border_color": "A8C7F7",
  "profile_sidebar_fill_color": "C0DFEC",
  "profile_text_color": "333333",
  "profile_use_background_image": true,
  "has_extended_profile": false,
  "default_profile": false,
  "default_profile_image": false,
  "pinned_tweet_ids": [],
  "following": false,
  "follow_request_sent": false,
  "notifications": false,
  "translator_type": "regular"
}

#3

If we keep on hitting the show users endpoint for every targeting then we will get rate limits, as there are hundreds of users added in a targeting for every ad set and there are thousands of ad sets. And we sync with twitter every 5-10 minutes.


#4

Hey @npurwar

I’m a bit confused here, it looks like when adding a Targeting Criteria for FOLLOWERS and SIMILAR_TO_FOLLOWERS_OF_USER you need to use the ID for the Twitter account as opposed to the name on the Twitter account. If so, you would need the @handle to map this to a Twitter account ID.

For example, using the sample from the original post,

{"line_item_id":"7qxqh","name":"iamsrk","id":"bzqgq0","account_id":"18ce53vjzfs","created_at":"2017-02-13T05:47:07Z","targeting_value":101311381,"updated_at":"2017-02-13T05:47:07Z","deleted":false,"targeting_type":"FOLLOWERS"}

Here, the value of targeting_value is 101311381 which corresponds to the @handle for iamsrk


#5

Hey, the use case is, when ads are synced with twitter, we get the targetings from twitter. We display those targetings on our platform. And for the users, we need to show them the Display names of the handles and not the @handle for FOLLOWERS and SIMILAR_TO_FOLLOWERS_OF_USER.
For making an API call to twitter we send only the ID but for showing the values to the user we need the names.
And if we keep on hitting the show user call, then we will get the rate limits.
I hope my use case is clear.


#6

Hey @npurwar

That makes sense, however at the moment, other than using the REST API endpoint , there isin’t another way of getting this information. Please note that the users/lookup endpoint allows you to pass upto 100 users per request.

Hope that helps!

Thanks!