Using web intents, how to determine in the user already follows you?

In my Chrome extension NiM I am using web intents however I need to figure out when to/not show the user a Follow link. I don’t want to show follow if the user is already following, but would rather show a Like intent.
Obviously this needs to be done without any type of auth other than what the user is logged in/not with. Is there a GET api point that doesn’t require auth (something I can XHR to) that I can use?

Unfortunately this is not possible.

Short of parsing the DOM and checking for the “following” string…
For example:

https://twitter.com/intent/follow?screen_name=nodeschooloak
shows the “Following” button because I’m logged in and follow that user, and

document.querySelector('#follow_btn_form > button').disabled
false

vs:
https://twitter.com/intent/follow?screen_name=andypiper

shows the “Follow” button because I don’t follow you.

document.querySelector('#follow_btn_form > button').disabled
true

I can get the answer I need this way… But it seems like this is a very fragile way of doing things, one which will inevitably break when the DOM get’s updated.
Cool, just wanted to make sure. Seems like that might be built in somehow. Showing Follow to followers seems like a not so great thing.

A supporting question is:
Is there an API endpoint or other Twitter endpoint which will reflect back the screen_name or user_id of the currently logged in user, and is designed for such?
I can pass that back to my own backend where I can auth to the Twitter API and check on that end to see if the user is a follower.

(editing my initial comment since I misread your post!)
There’s no API endpoint that doesn’t require authentication and that could do this on the front end, no.
We are taking comments and suggestions for the future version of the API that will replace v1.1. Feel free to describe your use case and need!


(Additionally when you refer to “other Twitter endpoint” - we only support the official Twitter API. Private endpoints, web scraping etc, are strictly prohibited, and as you observe, subject to breakage if we decide to make any internal changes)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.