Hi, I am having issues working with twitter API when trying to add the “additional_media_info” as a query parameter to the IAuthenticatedUser.PublishTweet method.
First, the video is uploaded successfully to the Media Studio Library with the additional info which contains: title, description, call_to_action_type and call_to_action_link.
Afterwards, I am calling to the IAuthenticatedUser.PublishTweet method in order to publish to the main user page in Twitter.
The problem is: when I try to add the “additional_media_info” as a custom query parameter (using the PublishTweetOptionalParameters.AddCustomQueryParameter method) to the PublishTweetOptionalParameters instance, then the IAuthenticatedUser.PublishTweet method (which gets the PublishTweetOptionalParameters instance as an argument) fails and throws the following TwitterException with the following members:
- TwitterExceptionInfos - one TwitterExceptionInfo with: Code = 32 & Message = “Could not authenticate you.”.
- TwitterDescription - “Unauthorized - Authentication credentials were missing or incorrect.”.
This is the structure of the “additional_media_info” query parameter which I add to the PublishTweetOptionalParameters instance using the AddCustomQueryParameter method:
{"<media_id>":{“embeddable”:false,“title”:“test title”,“description”:“test description”,“call_to_actions”:{“watch_now”:{“url”:""}}}}
Where: <media_id> = some media id that was already published to the Media Studio Library Successfully.
First, I initialize the PublishTweetOptionalParameters instance with the relevant mediaId (the one I’ve got after successfully uploaded the video to the Media Studio Library).
Then, I add the “additional_media_info” parameter to the PublishTweetOptionalParameters instance using the AddCustomQueryParameter method.
Without adding the “additional_media_info” parameter to the PublishTweetOptionalParameters instance - which means that this instance contains only the information about the mediaId to publish to the main user page - the IAuthenticatedUser.PublishTweet method succeeds and the video is published to the main user page on Twitter (as desired).
Have anyone encountered this problem also?
It seems like maybe there is no support at the moment of adding the “additional_media_info” query parameter to this request - IAuthenticatedUser.PublishTweet.
I tried many things like encoding some more characters when serializing the object that corresponds to the “additional_media_info” query parameter (replacing it with their ASCII values), but still it doesn’t work for me.
Which code library are you using for this? Does your app have access to the Ads API? You might need that to use additional_media_info. Actually - I’m not 100% certain whether that is settable in the API, or only inside of Media Studio.
Hey, thanks for your answer!
I am using the TweetinviAPI 4.0.0.
I am not sure whether my app have access to the Ads API, how can I verify that?
Maybe try a call to Accounts | Docs | Twitter Developer Platform ? I’m guessing that will work but maybe there’s a better way
Hey, my app do have access to the Ads API - I assume we wouldn’t be able to upload the video to the Media Studio Library with the additional info which contains the: title, description, call_to_action_type and call_to_action_link if not.
But again, it fails when we try to publish the tweet to the main user page with the additional_media_info query parameter - do you know if this feature is supported by Twitter API at all? or maybe only the upload to the media studio is supported?
Thanks!
I’m not a specialist on this part of the platform, but I believe that additional_media_info is read-only i.e. it is metadata returned by the API, but needs to be set in the Media Studio.
Yeah, but since I can upload the video with the additional info into to the Media Studio, I assumed I could do the same when publishing the tweet to the main user page - but for now it’s seems like we can’t do that.