Create my own follow button


#1

I would like to create a linked image and user can follow my site after clicking on it. Seems I cannot achieve this by using the standard solution: https://dev.twitter.com/docs/follow-button#using-an-iframe.

Is there other API’s that I can use to achieve this? I would like to have whole control on the HTML markup (what user see), and then use some JavaScript calls to make user following my site without navigate away. Is this possible?


#2

See [node:183] – there’s a follow intent that just works like a standard anchor tag, with which you can mark up as you like.


#3

Thanks for the responds. The Web Intents requires user navigate to another page. Is there a solution to achieve all of the following?

  1. use my own images and markup.
  2. user does not need to navigate to other page. A user signed in will add follow immediately after one click (like the iFrame follow button).
  3. A user not signed in will add follow after login (just like the iFrame follow button).

#4

Hi Bin Shao,

Remember that with Web Intents you don’t have to navigate the user away from your page, you can open them in a pop-up window over the top of your page.

If you want to have a custom, inline follow experience, you’ll need to build an application using the OAuth API and have the user authorize your website (to do an inline follow a user needs to be authorized.)

Ben


#5

Thanks Ben. You are right, the user was not navigate away. It is a pop-up. I just want to have a “one click” experience for the users (just like the follow button with iFrame). Two follow up questions:

  1. Seems that OAuth API is the only option for now to achieve this. For a user signed in, is it possible use the existing authentication?

For example, if a user already signed in to twitter (on twitter.com), is it possible I use the existing authentication on my site and add user as a follower without request the user to sign in again?

  1. Do I need to contact Twitter to add my app to the allowed list (if it exist) before using the OAuth API?

Thanks,
Bin


#6

A user doesn’t need to log in again, but they do need to authorize your application to use their account. You only need to do that once, after which you store the access token credentials on your side.

You don’t need to contact Twitter to use the API, just go to https://dev.twitter.com/apps to set one up and get your keys.


#7

Hello Ben -

Follow-up question:
Using O-auth, could we combine follow on twitter functionality with other services? For example, a custom ‘Follow’ button with clear messaging/iconography that triggers a follow request in my own web service (follow this topic on ‘MySite.com’), as well as a follow request on twitter?

Or alternatively, a follow button that exposes multiple options on click. For example:
‘Follow’
(menu on click):


#8

I think so long as you’re clear to the user what is happening, yes. You can integrate “Follow on Twitter” actions wherever makes sense within your UI.

I’d advise caution combining separate systems too tightly though: If a user later unfollows a person on Twitter but finds they’re still following them on your site, there could be confusion. But certainly chaining actions together is something you can do once you’re authed.

Ben


#9

#10