A Twitter app is what connects your Twitter account to your webhook (the main element of the experience: this is where you receive, process and send direct messages. ) and is where you configure various settings for the Twitter experience, set up your environment and generate the tokens.
In this guide, you'll learn how to set up a Twitter app.
Requirements
Before you begin, make sure you have a Twitter Developer Account. Your developer account is needed to create new projects and apps, which are the centerpiece of any Twitter integration. You can create a new developer account by logging into the Twitter https://developer.twitter.com/en/docs/developer-portal/overview developer website and clicking the "Signup for a developer account”.
One of the primary roles of the developer account is to enable to you manage your Projects and Apps. Developers can both create and manage Twitter Projects and Apps from the Dashboard in the developer portal. This is where you can find your App IDs; edit an App's setting, permissions, and callback URLs; and generate and revoke keys and tokens.
Creating a new Twitter Project
Projects allow you to organize your work based on how you intend to use the Twitter API so you can effectively manage your access to the API and monitor your usage. Each Project can contain one or multiple Apps depending on your access level (described later on this page). You will use these Apps to generate authentication credentials such as API Keys and Secrets, user Access Tokens, and App Access Token.
If you have a developer account, you can view and manage your Projects on the Projects & Apps page within the developer portal.
To create a Project, click on “New Project” in your dashboard or the Projects & Apps page within the developer portal. You’ll only be able to see this option if you haven’t already created a Project. You will be prompted to create a Project name, description, and use case. You will also be asked to create a new App or connect an existing standalone App.
Creating a new Twitter App
If your Project doesn’t include an App, you can add one by clicking on the Project name in the dashboard. From there, you can either create a new App or select an existing standalone App to connect to your Project. The App is where you can generate the authentication keys and tokens.
Generate tokens
Now you have to generate and memorize Access Token and Secret: an Access Token and Secret are user-specific credentials used to authenticate OAuth 1.0a API requests. They specify the Twitter account the request is made on behalf of.
Click on the app name, go to “Keys and tokens” section and click on “Generate” button.
Request elevated access
Apply for Elevated access here. Developers can apply for Elevated access with specific use case details. To ensure quick approval, please be as detailed as possible with your use case. Also, please pay close attention to the email address that is associated with the @user account that you used to apply. If Twitter team needs additional details about your use case, they will reach out to this email address with questions.
Request subscription fo account activity API
The Account Activity API provides you the ability to subscribe to realtime activities related to a user account via webhooks. This means that you can receive realtime Direct Messages and other account events from one or more of your owned or subscribed accounts through a single connection.
Set up User authentication
Authentication allows users to log in to your App with Twitter. It also allows your App to make specific requests for authenticated users. Ask for “Read and write and Direct message” permission.
Set up Dev environment
To begin using one of our subscription APIs, you need to set up a dev environment for the endpoint.
Go to “Dev environments” section an set up the environment.