Reputation: 5384
From my website, I would like any user to be able to tweet a specific url with an image to their Twitter accounts.
I have tried using the Button Widget but it seems I cannot embed media. To do that I need to use the Twitter REST API.
Question:
1) How do I set my webpage to use the Twitter REST API?
2) What Script do I import?
3) How do I ensure that we check first if the user is logged?
4) How do I ensure that the popup does not get blocked by the browser?
I cannot find anything that helps me on this basic steps online so I hope somebody here can help me start this project.
Many thanks in advanced.
Upvotes: 0
Views: 1064
Reputation: 866
The answer to most of your questions is to use a Twitter OAuth library and read up on the docs on Twitter's development site.
A library I have used is TwitterOAuth; this will take care of the authentication for you, and give you an easy way to make authenticated API calls.
Then, you will need to look at https://dev.twitter.com/docs/api/1.1/post/statuses/update and/or https://dev.twitter.com/docs/api/1.1/post/statuses/update_with_media.
Upvotes: 1