Hi, I have a total of 6 accounts and I have created a developer account for the main account.
I would like to know if it is possible to grant permissions so that I can retrieve tweet metrics from the other accounts without having to create developer and app accounts for all accounts. This is possible?
I found this in the documentation:
Public metrics can be requested with OAuth 2.0 Bearer Token authentication. Non-public metrics can be requested for owned/authorized Tweets only. This means developers are required to authenticate using OAuth 1.0a User Context authorization. If you need to generate an access token and secret for the Tweet owner, you can do so with the 3-legged OAuth process
But I don’t understand, I have no experience with api twitter.
As the text says from one account you can authorize another account, but how is this process done?
I have been able to do the 3-legged steps for my main account, but I don’t understand how to grant permissions to my other accounts …
.
You would use the Access tokens belonging to each of your accounts to get private metrics.
As the text says from one account you can authorize another account, but how is this process done?
You can use twurl to do this without implementing the full “Signin with twitter” flow - this might help explain: Multiple bot accounts - #2 by IgorBrigadir
ok, thanks IgorBrigadir, I understand better how it works and I have been able to create POSTMAN queries by hand to retrieve non-public metrics, changing the oauth_token for a couple of accounts that I have tested.
Now my challenge is to get it to work in qlik sense the same as in POSTMAN, at the moment in qlik sense it gives me authorization error 401 … I will continue investigating.
I think it’s because POSTMAN automatically generates the HMAC-SHA1 algorithm flow. Any idea to be able to replicate this elsewhere than POSTMAN?
The question I ask myself now is … once I do all the 3-legged Oauth flow in the final step I get oauth_token and oauth_token_secret authorization from the account I am authorizing.
How do I use this in API calls?
For example, I want to do this query about a tweet from an account:
api.twitter/2/tweets?ids=XXXXXXXXXXXXXXXXX,YYYYYYYYYYYYYYYY&tweet.fields=non_public_metrics,organic_metrics&media.fields=non_public_metrics,organic_metrics&expansions=attachments.media_keys
What headers do I have to use to make it work?
You will need to implement that yourself, in whatever way Qlik expects you to code implementations of http requests with oAuth headers. If there’s no Python or Java or Ruby or whatever interface you’ll have to manually do it.
To generate the appropriate http headers look at:
and
Thank you very much, I am understanding that my real challenge is to sign each request to the api.
I’m going for it, I hope somehow to get it
1 Like
If there’s a way to call a python script for example, or some other language, even Javascript from within Qlik you could use an existing library and save yourself a lot of trouble.