Troubleshooting: Twitter API Integration
Any errors that occur when sending an AppArmor Alert notification to the Twitter Alerting Mechanism will be logged in the notification’s tracking log. Below are some common errors that you may receive, and some troubleshooting steps you should take before contacting AppArmor Support.
401: Unauthorized
A 401: Unauthorized error occurs when the credentials supplied to AppArmor do not match the credentials in your Twitter Developer Portal.
Solution
Follow the steps in this article to refresh your Twitter API credentials and input them into the AppArmor Dashboard.
403: Forbidden
A 403: Forbidden error occurs when your credentials are correct, but you are trying to access Twitter functionality that you do not have access to. This most often occurs when you are trying to access the incorrect Twitter API version for your credentials.
As a general rule, Twitter API credentials for Twitter Projects or Apps created after April 29th, 2023 should use Version 2 of the Twitter API.
Solution
To change the Twitter API Version for your Twitter Integration, follow these steps:
In your AppArmor Dashboard, navigate to the Twitter Alerting Mechanism settings page
Click on the “Modify” button next to the Twitter Integration that is making the error occur
Change the “Twitter API Version” field from whatever it currently is to the other version.
Additional Steps: Add your Twitter App to a Project
Older Twitter Apps may not be nested within a Project on the Twitter Developer Portal. This prevents the app from accessing the Twitter API’s Version 2 endpoints.
To check if your Twitter App is considered a “stand-alone app”, follow these steps:
Navigate to https://developer.twitter.com/ and sign into the developer portal using the credentials that you use to sign in to your Twitter account.
Once you are signed in, click on the “Developer Portal” link to be taken to the portal
In the portal, expand the “Projects & Apps” section in the left-hand sidebar and click “Overview”
Once there, you will be able to see if your Twitter App is considered a “stand-alone app”
Solution
To add your standalone Twitter App to a Twitter Project, complete the following steps.
Click the “Add Project” button
Go through the steps to create your new Twitter Project
You can use whatever name you want for your project. We suggest including “AppArmor” in the title.
Select “Build customized solutions in-house” as your use case.
We suggest using the following verbiage for the Project Description:
This application is part of a unified mass notification platform, which allows our security department to send safety notifications over multiple channels with a single action. Other channels include posting to our website, and sending a push notification to our mobile safety smartphone app. We'd like to use this app to include a Tweet to our Twitter account at the same time, to inform users via Twitter of campus safety information. Our application will utilize Twitter APIs in order to allow users to send a Tweet from the web-based Dashboard. This is a single-purpose application - it will only be used for the institutional Twitter handle to Tweet in the way described above.
When you get to App Setup, choose “Add an existing App”
Select your app to add to the project