Preview not coming for Ads API tweet


#1

GET, url=‘https://ads-api.twitter.com/1/accounts/18ce53vjzfs/tweet/preview/839744836852817921?preview_target=TWITTER_TIMELINE’, postParams=[], authentication=OAuthAuthorization{consumerKey=‘bLvcK5WM1VJyWtJTL5Hpg’, consumerSecret=’******************************************’, oauthToken=AccessToken{screenName=‘null’, userId=3311953868}}

{“errors”:[{“code”:“NOT_FOUND”,“message”:“User 296651969 was not found”}],“request”:{“params”:{}}}


#2

We’re not able to repro, @abhishek_pyro, and we’re not seeing anything in our logs. Could you provide the response headers, by chance?

$ twurl -H ads-api.twitter.com "/1/accounts/18ce53vjzfs/tweet/preview/839744836852817921?preview_target=TWITTER_TIMELINE" | jq
{
  "data_type": "tweet_view",
  "data": [
    {
      "platform": "web",
      "preview": "<!DOCTYPE html> <html> <head>   <meta charset=\"utf-8\" />      <link href=\"https://ton.twimg.com/macaw-campaigns/css/tweet_preview.bundle.1b51d33968282102cfa4.css\" rel=\"stylesheet\" /> </head>  <body>     <div class=\"Tweet--timeline Tweet   Tweet--web          \"  data-tweet-id=\"839744836852817921\">    <img class=\"Tweet-avatar\" src=\"https://pbs.twimg.com/profile_images/378800000228998787/90a17e6744affceb83b6883b6d47012a_normal.png\" width=\"48\" height=\"48\" alt=\"\"/>    <div class=\"Tweet-body\">     <div class=\"Tweet-header\">       <div class=\"Tweet-userData\">         <a href=\"https://twitter.com/DreamMalar\" target=\"_blank\" class=\"Tweet-name\">DreamMalar</a>         <a href=\"https://twitter.com/DreamMalar\" target=\"_blank\" class=\"Tweet-screenName\">@DreamMalar</a>       </div>         <small class=\"Tweet-timeLabel\">         <span class=\"Tweet-timestamp\">           <span class=\"Icon Icon--clock\"></span>                    </span>       </small>     </div>       <div class=\"Tweet-text \" dir=\"\">RT <twittermention>@</twittermention><a class=\"tweet-url username\" href=\"https://twitter.com/KowalityK\" rel=\"nofollow\">KowalityK</a>: cheking this</div>       </div>     <div class=\"Tweet-footer\">          <div class=\"Tweet-context Tweet-context--promotion\">   <div class=\"Tweet-badge Tweet-badge--promotedBy\">      <span class=\"Icon Icon--promoted Icon--small\"></span>      <span class=\"Tweet-badgeText\">Promoted</span>   </div> </div>    </div> </div>   </body> </html> "
    },
    {
      "platform": "android",
      "preview": "<!DOCTYPE html> <html> <head>   <meta charset=\"utf-8\" />      <link href=\"https://ton.twimg.com/macaw-campaigns/css/tweet_preview.bundle.1b51d33968282102cfa4.css\" rel=\"stylesheet\" /> </head>  <body>     <div class=\"Tweet--timeline Tweet   Tweet--android          \"  data-tweet-id=\"839744836852817921\">    <img class=\"Tweet-avatar\" src=\"https://pbs.twimg.com/profile_images/378800000228998787/90a17e6744affceb83b6883b6d47012a_normal.png\" width=\"48\" height=\"48\" alt=\"\"/>    <div class=\"Tweet-body\">     <div class=\"Tweet-header\">       <div class=\"Tweet-userData\">         <a href=\"https://twitter.com/DreamMalar\" target=\"_blank\" class=\"Tweet-name\">DreamMalar</a>         <a href=\"https://twitter.com/DreamMalar\" target=\"_blank\" class=\"Tweet-screenName\">@DreamMalar</a>       </div>         <small class=\"Tweet-timeLabel\">         <span class=\"Tweet-timestamp\">           <span class=\"Icon Icon--clock\"></span>                    </span>       </small>     </div>       <div class=\"Tweet-text \" dir=\"\">RT <twittermention>@</twittermention><a class=\"tweet-url username\" href=\"https://twitter.com/KowalityK\" rel=\"nofollow\">KowalityK</a>: cheking this</div>       </div>     <div class=\"Tweet-footer\">          <div class=\"Tweet-context Tweet-context--promotion\">   <div class=\"Tweet-badge Tweet-badge--promotedBy\">      <span class=\"Icon Icon--promoted Icon--small\"></span>      <span class=\"Tweet-badgeText\">Promoted</span>   </div> </div>    </div> </div>   </body> </html> "
    },
    {
      "platform": "iphone",
      "preview": "<!DOCTYPE html> <html> <head>   <meta charset=\"utf-8\" />      <link href=\"https://ton.twimg.com/macaw-campaigns/css/tweet_preview.bundle.1b51d33968282102cfa4.css\" rel=\"stylesheet\" /> </head>  <body>     <div class=\"Tweet--timeline Tweet   Tweet--iphone          \"  data-tweet-id=\"839744836852817921\">    <img class=\"Tweet-avatar\" src=\"https://pbs.twimg.com/profile_images/378800000228998787/90a17e6744affceb83b6883b6d47012a_normal.png\" width=\"48\" height=\"48\" alt=\"\"/>    <div class=\"Tweet-body\">     <div class=\"Tweet-header\">       <div class=\"Tweet-userData\">         <a href=\"https://twitter.com/DreamMalar\" target=\"_blank\" class=\"Tweet-name\">DreamMalar</a>         <a href=\"https://twitter.com/DreamMalar\" target=\"_blank\" class=\"Tweet-screenName\">@DreamMalar</a>       </div>         <small class=\"Tweet-timeLabel\">         <span class=\"Tweet-timestamp\">           <span class=\"Icon Icon--clock\"></span>                    </span>       </small>     </div>       <div class=\"Tweet-text \" dir=\"\">RT <twittermention>@</twittermention><a class=\"tweet-url username\" href=\"https://twitter.com/KowalityK\" rel=\"nofollow\">KowalityK</a>: cheking this</div>       </div>     <div class=\"Tweet-footer\">          <div class=\"Tweet-context Tweet-context--promotion\">   <div class=\"Tweet-badge Tweet-badge--promotedBy\">      <span class=\"Icon Icon--promoted Icon--small\"></span>      <span class=\"Tweet-badgeText\">Promoted</span>   </div> </div>    </div> </div>   </body> </html> "
    }
  ],
  "request": {
    "params": {
      "preview_target": "TWITTER_TIMELINE",
      "tweet_id": 839744836852817900,
      "account_id": "18ce53vjzfs"
    }
  }
}

#3

{null=[HTTP/1.1 403 Forbidden], content-type=[application/json;charset=utf-8], x-frame-options=[SAMEORIGIN], x-rate-limit-remaining=[1998], x-response-time=[196], content-encoding=[gzip], date=[Thu, 09 Mar 2017 12:16:53 GMT], x-transaction=[00a40e7e003f8e16], x-connection-hash=[0481fc845ded6752482aa966a4c26064], x-xss-protection=[1; mode=block], x-content-type-options=[nosniff], x-rate-limit-limit=[2000], x-runtime=[0.053381], x-api-version=[1.0], set-cookie=[guest_id=v1%3A148906181304112596; Domain=.twitter.com; Path=/; Expires=Sat, 09-Mar-2019 12:16:53 UTC], content-length=[118], x-rate-limit-reset=[1489061996], content-disposition=[attachment; filename=json.json], server=[tsa_f], strict-transport-security=[max-age=631138519], x-access-level=[read-write-directmessages]}

We’re using the Tweet of a RETWEET_ONLY promotable account and trying to get its preview


#4

@abhishek_pyro: Is the authenticating user 3311953868 (account ID 18ce543yg7o)?

Here are the promotable users associated with this ads account is:

$ twurl -H ads-api.twitter.com "/1/accounts/18ce543yg7o/promotable_users" | jq
{
  "request": {
    "params": {
      "account_id": "18ce543yg7o"
    }
  },
  "data": [
    {
      "user_id": "3311953868",
      "id": "bw6xm",
      "account_id": "18ce543yg7o",
      "created_at": "2015-09-02T05:31:50Z",
      "updated_at": "2017-03-06T15:00:55Z",
      "deleted": false,
      "promotable_user_type": "FULL"
    }
  ],
  "data_type": "promotable_user",
  "total_count": 1,
  "next_cursor": null
}

Notice that user 296651969 (account ID 18ce53vjzfs) is not a promotable user. This is why you’re seeing the NOT_FOUND error.


#5

Hey @juanshishido there is some confusion on our part regarding the same,

An Ad Account has access to two types of Promotable users, FULL and RETWEETS_ONLY, in our case the Ads Account 18ce53vjzfs has access to

{
"user_id":"341724346",
"id":"jk4mx",
"account_id":"18ce53vjzfs",
"created_at":"2016-05-20T15:04:21Z",
"updated_at":"2016-08-03T14:31:15Z",
"deleted":false,
"promotable_user_type":"RETWEETS_ONLY"
}

Now we selected an existing tweet from 341724346 and promoted it from Ad Account 18ce53vjzfs.

twurl -X GET -H ads-api.twitter.com /1/accounts/18ce53vjzfs/promoted_tweets?line_item_id=81ctw | python -m "json.tool"
{
    "data": [
        {
            "approval_status": "ACCEPTED",
            "created_at": "2017-03-09T07:49:05Z",
            "deleted": false,
            "display_properties": [],
            "id": "17ly5q",
            "line_item_id": "81ctw",
            "paused": false,
            "tweet_id": "839744836852817921",
            "updated_at": "2017-03-09T07:49:05Z"
        }
    ],
    "data_type": "promoted_tweet",
    "next_cursor": null,
    "request": {
        "params": {
            "account_id": "18ce53vjzfs",
            "line_item_id": "81ctw"
        }
    },
    "total_count": 1
}

On trying to get the preview of the tweet 839744836852817921 promoted from 18ce53vjzfs we would give the authentication details of the same ad account.

Doubts
Is the authenticating user 3311953868 (account ID 18ce543yg7o)?
Not sure what we are missing here, since the ad account in our context is 18ce53vjzfs and not 18ce543yg7o.

The use case is to show preview of the tweet 839744836852817921 which is a retweet of https://twitter.com/KowalityK/status/839744829865222144 in our system using the as_user_id parameter.

Thanks


#6

Thanks for the clarification, @abhishek_pyro! We’ll investigate further and let you know what we find.


#7

@juanshishido thanks for the help on this, has something changed with the preview API? we aren’t getting previews for the tweets from the FULL_PROMOTABLE handles as well now.

Same error {“errors”:[{“code”:“NOT_FOUND”,“message”:“User 296651969 was not found”}],


#8

Yes, you’re right, @abhishek_pyro. We’re able to repro the FULL promotable users issue with the Tweet preview endpoint and are working on a fix. Thanks!


#9

@abhishek_pyro: We’ve identified the issue and are currently testing a fix. If all goes well, the fix should be deployed in the next few days.


#10

@abhishek_pyro: We’ve deployed a fix for both of these issues. In our testing, we’re able to get a preview of a RETWEETS_ONLY (as well as the FULL) promotable user. Please confirm whether this has been resolved on your end. Thanks again for bringing this to our attention!


Promoted Tweet Report with python SDK
#11

really appreciate it, this feature is one of my personal favourites, its working now, thanks :slight_smile: