DEV Community

Jessica Garson for XDevelopers

Posted on • Edited on • Originally published at developer.twitter.com

Tweet to Super Followers with Postman, OAuth 2.0 and Manage Tweets

We recently launched Manage Tweets with a feature to Tweet directly to Super Follows. This tutorial will walk you through how to get started using the Twitter API to Tweet to your subscribers using OAuth 2.0 and Postman.

What is Super Follows?

Super Follows is an opportunity to earn monthly revenue by sharing subscriber-only content with your most engaged followers on Twitter. Through Super Follows, creators like you can create a monthly subscription of $2.99, $4.99, or $9.99 a month, where you could give access to exclusive content or insights into your creative process for creating your bot. In addition, super Followers enjoy extra special access to unfiltered thoughts, early previews, and subscriber-only conversations from their favorite accounts.

How to Apply to Super Follows

You will need to have Super Follows enabled on your account to follow this tutorial. To apply to set up a Super Follows subscription, you will need to follow these steps:

  1. Swipe open the sidebar on your home timeline
  2. Tap on “Monetization
  3. ”Select “Super Follows”

After you apply, our team will review your application shortly. You will also need to sign up for a developer account if you don’t already have one.

Setting up Postman

You will first want to download Postman if you have not already done so. After you have Postman enabled, you will want to download the Twitter API v2 collection. To learn more about getting started with the Postman and the Twitter API, check out our documentation on the subject.

Generating an OAuth 2.0 Token

For this tutorial, you will use OAuth 2.0 with PKCE to make requests on behalf of the Super Followers enabled account. To authenticate using OAuth 2.0, you must create an OAuth 2.0 token using the following step. First, In the “Manage Tweets” folder of the Twitter API v2 collection, go to the tab entitled “Authorization” and select “OAuth 2.0”.

In this tab, be sure to follow these steps:

  1. Name your token
  2. Select the Grant Type as Authorization Code (with PKCE)
  3. Update the parameters:
  4. Review the proper scopes for Manage Tweets on this page.
  5. Update the scopes with the following values: tweet.read users.read tweet.write
  6. Populate the field state with “State”
  7. Click where it says “Generate Token”
  8. Press the save icon to save the folder changes.

You may get a message that you are not logged into Twitter. If you get this error, you will need to log in to the Twitter account inside of Postman you are trying to post on behalf of.

Tweet to your Super Followers

In the Postman Collection, you should find a sample request for “Manage Tweets.” Select the POST request called “Create a Tweet.”

You will want to go into that request and change the “Authorization” tab of the request and select “Inherit auth from parent” to ensure you are using the token you created in the last step.

Next, update the “Body” tab of the request to the following:

{
   "text": "Hello, Super Followers!",
   "for_super_followers_only": true
}
Enter fullscreen mode Exit fullscreen mode

You can now press the blue button that says “Send” and see a response that looks like this one.

{
   "data": {
       "id": "1491508991335272449",
       "text": "Hello, Super Followers!"
   }
}
Enter fullscreen mode Exit fullscreen mode

Next steps

Hopefully, this can be a starting point for you to get started with Tweeting programmatically to Super Followers using Postman and OAuth 2.0. To generate a code sample in the language of your choosing, click on the button in Postman that says “Code." Additionally, you may want to write some language to schedule specific Tweets on a schedule to your subscribers and run your code on a server.

Be sure to let us know on the forums if you run into any troubles along the way, or Tweet us at @TwitterDev if this tutorial inspires you to create anything.

Top comments (0)