Articles on: OneHash Chat | Account Setup

Twitter Set Up for OneHash Chat

Twitter App Setup



Twitter channel with OneHash Chat requires access to Twitter APIs. We are using Account Activity API. If you don't have access to Twitter Business APIs, apply for one at Twitter developer portal.

Once your application is approved, you will be able to add Twitter Apps and dev environments. If you have applied for a team account, you can invite more team members. You will have to set the following environment variables for the channel to work. We will describe what it means in the following sections.

TWITTER_APP_ID=
TWITTER_CONSUMER_KEY=
TWITTER_CONSUMER_SECRET=
TWITTER_ENVIRONMENT=


1. Twitter standalone App


One way to handle Twitter API is through a standalone app, which doesn't require the creation of a project to create an app,

Create a Twitter App

In Twitter Developer Portal, go to Projects & Apps Overview Console. Then, go to the "Standalone Apps" section. Then, click on the "Create App" button.




Provide an app name and click on "Next".






You will be able to see the API Key and API Secret Key in the next step. Save this information as it would not available again.



Use API Key as TWITTER_CONSUMER_KEY in OneHash Chat.

Use API Secret Key as TWITTER_CONSUMER_SECRET in OneHash Chat.




Hooray! The app has been created. The next step is to enable "Sign in with Twitter" permission.

Complete profile information


Complete the application profile. See the "App Details" section as shown below for additional information. Then Update the name, logo and description. Finally, use the APP ID displayed in the screenshot as TWITTER_APP_ID in OneHash Chat.




Select authentication settings


OneHash works with Twitter API OAuth 1.0. So select OAuth 1.0a from the authentication settings page.




Add app permissions

Head over to the "App Permissions" section by clicking the setup button above. Then, update the permission to "Read and Write and Direct Messages".




Update general authentication settings

Add the callback url as {your_onehashchat_installation_url}/twitter/callback.




Complete the rest of the details in the authentication settings and click on "Save". And it's ready to use. Use all the API keys in your setup.



2. Create Twitter API project



There is one more way to create a Twitter app. Instead of a standalone app, create a project and add the app to the project.

Add project details


Add project name, select project type, add a project description

Click on create project



Add project name




Select project type



Add project description




_App setup_

Once you setup the project, you move on to the app setup. Select the appropriate environment for your self-hosted app according to the status of your application. Please note this is not the same environment as we set up in OneHash Chat. We are going to see about TWITTER_ENVIRONMENT at a later point.





After this step, you should follow the similar step for an API key and secret in step 1, set the app name and go to the next step. You will get the API key and API secret keys. Save those keys.



Use API Key as TWITTER_CONSUMER_KEY in Chatwoot.
Use API Secret Key as TWITTER_CONSUMER_SECRET in Chatwoot.

PS: After you complete Step 1 or Step 2 (both steps are alternative to each other), move on to the below step to set up the dev environment.

Create a dev environment (required)



For the DMs and Tweets to work in realtime, you need to set up an "Account Activity API" dev environment. A Twitter development environment is required for all installations of OneHash Chat.

URL: https://developer.twitter.com/en/account/environments

Head over to Products -> Premium -> Dev Environments. Click on Set up dev environment. You will be able to see a form as follows.




Provide a Dev Environment Label. This should be an alphanumeric string. Use the exact string as TWITTER_ENVIRONMENT in OneHash Chat.




Once you do this, you will be ready to use Twitter Channels. To connect your Twitter account, follow this guide.

Updated on: 10/11/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!