Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twitter v2.0 API not supported (returns 403) #899

Open
joepavitt opened this issue Apr 8, 2022 · 26 comments
Open

Twitter v2.0 API not supported (returns 403) #899

joepavitt opened this issue Apr 8, 2022 · 26 comments

Comments

@joepavitt
Copy link

joepavitt commented Apr 8, 2022

Which node are you reporting an issue on?

Twitter

What are the steps to reproduce?

  1. Create a new instance of Node-RED
  2. Add the Twitter node
  3. Add an App/Project through the Twitter Developer Portal

What happens?

  • Receive a "stream error: http (403)" error from the Twitter API

This is because Twitter have restricted access for "Essential" developer accounts (the default account provided when signing up for a Twitter developer account) to using the v2 API only. In order to use the v1.1 API, developers must have an "Elevated" account.

What do you expect to happen?

  • Should be able to utilise the Twitter nodes, without the requirement to upgrade to an "Elevated" Twitter dev account.
@joepavitt
Copy link
Author

There is an updated Twitter NodeJS SDK: https://www.npmjs.com/package/twitter-api-v2

@Steve-Mcl and I have tested that this works in Node-RED by installing it as an npm package and used the following example, to listen for any tweet mentioning 'Boris Johnson' in a function node:

const { TwitterApi, ETwitterStreamEvent } = twitterApiV2;

// Instanciate with desired auth type (here's Bearer v2 auth)
const twitterClient = new TwitterApi("<Bearer_Token>");

// Tell typescript it's a readonly app
const roClient = twitterClient.readOnly;

const addedRules = await roClient.v2.updateStreamRules({
    add: [
        { value: 'Boris Johnson' },
    ],
});

// const stream = roClient.v2.sampleStream({ autoConnect: true });
const stream = await roClient.v2.searchStream();

stream.on(ETwitterStreamEvent.Connected, function () {
    node.send({
        payload: "Connected"
    });
});
stream.on(ETwitterStreamEvent.ConnectError, function() {
    node.send({
        payload: "Conect Error"
    });
});
stream.on(ETwitterStreamEvent.ConnectionError, function () {
    node.send({
        payload: "Conection Error"
    });
});
stream.on(ETwitterStreamEvent.Error, function () {
    node.send({
        payload: "Error"
    });
});
stream.on(ETwitterStreamEvent.Data, function () {
    node.send({
        payload: [...arguments]
    });
});

@joepavitt joepavitt changed the title Twitter v2.0 APiInot supported Twitter v2.0 API not supported Apr 8, 2022
@joepavitt joepavitt changed the title Twitter v2.0 API not supported Twitter v2.0 API not supported (returns 403) Apr 8, 2022
@boomvalt
Copy link

This problem also happens even with elevated status. Twitter Out works fine, but Twitter In still gets the 403 on public searches. Tweets from followed accounts works as expected..

@shahramdj
Copy link

I have developed a node-red-twitter-node that gets the public searches. You can find the code here: https://github.com/shahramdj/nodered_twitter_api
I also made a youtube video that shows how you can use the new node: https://www.youtube.com/watch?v=HYn3sIDcIv4&t=78s

@hardillb
Copy link
Member

hardillb commented Oct 6, 2022

@shahramdj rather than adding another node to the catalogue could we persuade you to raise a pull request to fix the existing node. This way there is just one that works and people don't have to pick from multiple options and it's the one from the community that people are likely to already have installed. Thanks

@shahramdj
Copy link

@hardillb sure, I will send a pull request to fix the existing node.

@akashtalole
Copy link

Existing twitter node must be migrated from twitter-ng to twitter-api-v2(https://www.npmjs.com/package/twitter-api-v2)

@dceejay
Copy link
Member

dceejay commented Nov 20, 2022

... or wait a couple of months and see what happens :-)

@gemini86
Copy link

gemini86 commented Dec 5, 2022

... or wait a couple of months and see what happens :-)

Are we to take this to mean the devs are not supporting this node anymore?

@knolleary
Copy link
Member

Hi @gemini86

I think the comment from @dceejay was more related to the ongoing turmoil with Twitter the company and doubts over whether the company was going to have anyone left to keep it running.

More generally, there are dozens of nodes in this repository. Ideally we'd have the resources available to fix everything and implement everything - but unfortunately we don't. The degree to which any particular node gets maintained depends a lot on how widely used it is, how much community interest there is in it and whether people want to contribute to the project to help maintain them.

@gemini86
Copy link

gemini86 commented Dec 5, 2022

I'm aware, which is why I asked without getting into the politics of it. I guess we wait?

@dceejay
Copy link
Member

dceejay commented Dec 5, 2022

... or help @shahramdj fix/rewrite it :-)

@ohrenweide
Copy link

Announcing the deprecation of v1.1 statuses/filter endpoint

I guess that means the node will stop working on 9 March 2023?

@ArfyFR
Copy link

ArfyFR commented May 27, 2023

See
#1000
I am unable to tweet from Node-red

@ohrenweide
Copy link

Thank you [ArfyFR] for pointing this out. For me personally, however, the abolition of free unlimited API access has settled the matter. I will not pay money for the opportunity to add value to the platform through useful bots.

@ArfyFR
Copy link

ArfyFR commented May 27, 2023

Thank you [ArfyFR] for pointing this out. For me personally, however, the abolition of free unlimited API access has settled the matter. I will not pay money for the opportunity to add value to the platform through useful bots.

If I understand right:
Unlimited: yep no more, but Tweet caps - Post 1,500 (I suppose per month)
v1.1 is for media only now
V2 we should still able to send tweets

But in node-red code both try to add media and text with V1.1 => fail

@ohrenweide
Copy link

Unlimited: yep no more, but Tweet caps - Post 1,500 (I suppose per month)

I have been running #NowPlaying bots for BBC Radio 1/ 2/3 and BBC6Music. The limit of 1500 tweets per month is already exceeded after a few days in this case 🤷

@8666
Copy link

8666 commented Aug 14, 2023

I post less then few tweets per day and I find this plugin very useful. Is anyone working on this?

@joepavitt
Copy link
Author

I post less then few tweets per day and I find this plugin very useful. Is anyone working on this?

no immediate plan that I'm aware of, with the Twitter API restrictions added, I think this dropped in priority as I understood that you needed to pay for API access now?

@8666
Copy link

8666 commented Sep 1, 2023

Posting is free (with limits) but some endpoints are not available for free anymore

@jbwiden
Copy link

jbwiden commented Nov 9, 2023

Anybody working on a fix? Would be nice to be able to use the node to send tweets.

@shahramdj any luck with the pull request?

@joepavitt
Copy link
Author

Nobody seems to have grabbed this yet unfortunately @jbwiden

@shahramdj
Copy link

The twitter API has changed a lot, it is not free anymore and even my fix for API version 2 does not work now.

@jbwiden
Copy link

jbwiden commented Nov 14, 2023

My understanding is that there is still capability at the free tier but is more limited than in the past.

Free: Free, instant access to the X API. Includes 1,500 Posts /month and a single App environment. 1 App, 1 Project.

https://developer.twitter.com/en/support/twitter-api/v2

@shahramdj
Copy link

I had a look again and even the basic API V2 example code does not work, I get 403 error when I try to call the rules URL. I tried to find new examples, code snippets, etc. but most of the links are broken. I am not sure, maybe the free version is not their priority and they are too busy with fixing the enterprise version. Unfortunately, there is no chance at this point to fix this. If you can find any working Nodejs code that gets the twitter stream, I will be more than happy to take it and fix the node-red node twitter based on that.

@jbwiden
Copy link

jbwiden commented Jan 8, 2024

Thanks for looking into it, sorry to hear it is seemingly a non operational API now

@lzilioli
Copy link

lzilioli commented Jun 9, 2024

It seems like this package works with Bearer tokens: https://www.npmjs.com/package/twitter-api-v2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests