trygve-lie / twitter-stream-api

A Twitter Stream API client
47 stars 11 forks source link

How is this library going to work with the Enterprise plan? #173

Open dandv opened 6 years ago

dandv commented 6 years ago

https://techcrunch.com/2017/12/19/twitter-launches-a-new-enterprise-api-to-power-customer-service-and-chatbots/

https://developer.twitter.com/en/docs/accounts-and-users/subscribe-account-activity/api-reference/site-stream

Also, the link to "Twitter Stream API" in the README is now broken.

trygve-lie commented 6 years ago

Not 100% since I've not had time to look into it.

Twitter have had a separate bigpipe plan for a long time which only selected customers have access too. I've never had, so I've never had the chance to test against it, but how one connect to it is the same as all other stream end points so in theory this lib works against the bigpipe plan. I've just never been able to test that. I expect the new Twitter API to connect in the same way as before but there are new endpoints.

I'll try to find some time to start digging into it soon. PRs on the new API is welcome also.

trygve-lie commented 6 years ago

So, PowerTrack seems to be the new API: https://developer.twitter.com/en/docs/tweets/filter-realtime/api-reference/powertrack-stream

Connecting to it seems to be as before. Iow; this client should be able to do so. We just need to add the endpoint. Though, its a bit hard to test since I don't have access to it. Do you have access to it in any way?

trygve-lie commented 6 years ago

Seems to be a 30 day dev access to it: https://developer.twitter.com/en/docs/tweets/search/overview/enterprise

That might give us access to test any implementation.

dandv commented 6 years ago

Thanks for looking into this. Did you mean you found a 30-day developer trial period? The link only mentions searching among the last 30 days worth of tweets.

I'm trying to figure out what the transition plan is for streaming APIs like get/site. The Account Activity API doesn't really seem to do the same thing.

dandv commented 6 years ago

Unfortunately I don't have Enterprise access and I'm just building an app for personal use.

I'm using the module and I get a 403 in the connection error http handler for the site stream, but other streams, e.g. statuses/filter, do work, with the same credentials.

const friendIds = (await T.get('friends/ids', { screen_name: 'dandv' })).data.ids.slice(0, 10);
console.log(friendIds);  // looks good

TStream.stream('site', {
  follow: friendIds.join(','),
  stall_warnings: true,
});

TStream.on('connection error http', function (httpStatusCode) {
  console.log('connection error http', httpStatusCode);  // 403
});

TStream.on('data', function (obj) {
  console.log('data', obj);
});

Does this library support the 'site' feed? It requires user context auth, so maybe https://developer.twitter.com/en/docs/basics/authentication/overview/basic-auth?