Have you built something with the Twitter API v2?

Whether it is sample code, visualizations or any app that uses the new Twitter API v2 - Share it as an entry below.

If you are one of the first 10 developers to share what you’ve built with the new Twitter API, we may send some cool swag your way!

Haven’t tried out the new Twitter API v2 yet? No worries! Check out this tutorial on a Step-by-step guide to make your first request to the new Twitter API v2

2 Likes

Github

Quick Introduction

Built a Python API Client. It supports almost all API v2 endpoints including FilteredStream, SampledStream, RecentSearch, TweetLookUp, UserLookUp, and Hide Replies. The objective is to make it easier for developers to consume the latest APIs.

Here’s an example of how easy it is to consume the Sampled Stream. Construct cleaner and eloquent queries. Go through Sampled Stream’s API Reference, get your desired query parameter, and just assign their values to in a list. Twitter-Stream.py will does all the heavy lifting for you.

# sampled_stream.py

import json
from twitter_stream import SampledStream

class Stream(SampledStream):
    user_fields = ['name', 'location', 'public_metrics']
    expansions = ['author_id']
    tweet_fields = ['created_at']

stream = Stream()
for tweet in stream.connect():
    print(json.dumps(tweet, indent=4))

Installation

~$ pip3 install twitter-stream.py

Set the Environment Variable

~$ export BEARER_TOKEN=BEARER_TOKEN

I’m trying not to clutter up this thread with more examples. Please do visit the examples folder for more detailed examples on the other endpoints.


twitter: @twitivitydev we post articles and Short Code Snippets.
docs: twitivity.dev/docs
github: GitHub - twitivity/twitter-stream.py: Python API Client for Twitter API v2
report an issue: Issues · twitivity/twitter-stream.py · GitHub

6 Likes

At FPTraffic.com we used features of the Twitter API v2 to provide performance metrics into our scheduling service. This allows us to show our customers the reach for their most recent tweets along with recommendations on the best days/times to tweet. We’re working on adding these metrics into more of our features to provide more splits.

6 Likes

So simple and great - thanks so much for building and sharing!

1 Like

Love this. Would love to see a demo sometime!

Hello, sorry for sorry for the disturbance, I need your help. my twitter API V2 Elevated Level is in pending since a week, could you help me to have acces to this level ?

Hi, I’m Rishi. I’ve recently added support for Spaces in a Twitter Web client I’m working on, it’s called Kizie.

Kizie is using multiple v2 endpoints including the one for Spaces, User Timeline, User’s followers/following lists etc. Best thing about v2 endpoints is they’re very easy to process and have more information like metrics and engagement data etc.

Below’s a preview of home timeline in Kizie showing space details. It fetches the space details based on Space link shared in the tweet. The user though have to go to Twitter.com to join the space :slight_smile:

FIDXgzCUUAAh1mR

I’m planning to switch to v2 endpoints as soon as the home_timeline endpoint goes live. I’m also working on a twitter-text for v2 endpoints, might open-source it.

Having looked through the documentation and the setup for API, it looks like it isn’t possible to just create a tweet using python on my local machine / private server. Does anyone have any examples please?

And by working example I mean from scratch on creating a new project in 2023.

Here may be a good place to start: Examples — tweepy 4.12.1 documentation

Or maybe Twitter-API-v2-sample-code/create_tweet.py at main · twitterdev/Twitter-API-v2-sample-code · GitHub for the authentication steps too.

Or did you mean the actual Project / App on the developer dashboard?