User not authorized to create scheduled tweets


#1
$ twurl -H ads-api.twitter.com -XPOST "/3/accounts/18ce54nehwo/scheduled_tweets?text=test&scheduled_at=2018-02-28T07:58:00Z&nullcast=true" | jq .
{
  "errors": [
    {
      "code": "NOT_FOUND",
      "message": "Promotable User 870127656477483008 was not found for Account 18ce54nehwo"
    }
  ],
  "request": {
    "params": {}
  }
}

I’ve verified the current user has the right to compose tweet for the 18ce54nehwo account.

$ twurl -H "https://ads-api.twitter.com" -X GET "/2/accounts/18ce54nehwo/authenticated_user_access" | jq .
{
  "data": {
    "user_id": 870127656477483008,
    "permissions": [
      "TWEET_COMPOSER",
      "ACCOUNT_ADMIN"
    ]
  },
  "request": {
    "params": {
      "account_id": "18ce54nehwo"
    }
  }
}

#2

Hi @wenping.wang

If you looks closely to your post you can see, in the first request Promotable User has ID:

870127656477483008

And in the second one

870127656477483000

The last number is not correct

Regards


#3

@hector_borras

870127656477483008 is the user_id_str for ‘user_id’ (870127656477483000)


#4

Thanks for the question, @wenping.wang, and for providing these details.

You’re doing the right thing checking the GET accounts/:account_id/authenticated_user_access endpoint.

It looks like you’re authenticated as user 870127656477483008. When you’re creating any type of Tweet—POST accounts/:account_id/scheduled_tweets or POST accounts/:account_id/tweet—remember to specify the as_user_id if the user (the owner of the ads account) you are creating a Tweet for is not the same as the authenticated user. In this case, 18ce54nehwo is owned by some other user, not 870127656477483008.

Try making the Scheduled Tweet create request using as_user_id={user_id}.


Note: I’ve edited the original post to reflect the correct user ID.


#5

@juanshishido

The same error returned even I have request using as_user_id=870127656477483008.

$ twurl -H ads-api.twitter.com -XPOST "/3/accounts/18ce54nehwo/scheduled_tweets?text=test&scheduled_at=2018-02-28T07:58:00Z&nullcast=true&as_user_id=870127656477483008"
{"errors":[{"code":"NOT_FOUND","message":"Promotable User 870127656477483008 was not found for Account 18ce54nehwo"}],"request":{"params":{}}}

#6

Oops. Apologies for the confusion. See the other part of my previous reply:

remember to specify the as_user_id if the user (the owner of the ads account)… In this case, 18ce54nehwo is owned by some other user, not 870127656477483008.

In other words, don’t use 870127656477483008. Instead, use the user ID for the owner of the ads account.


#7

@juanshishido
You mean that I should request with the user id of 18ce54nehwo
something like "/3/accounts/18ce54nehwo/scheduled_tweets?text=test&as_user_id={user_id for 18ce54nehwo}


#8

Yes, that’s correct. Please confirm whether this helps resolve your issue.