Hide replies v2
Interested in exploring Labs?
The endpoints we release in Labs are previews of tools that may be released more broadly in the future, but will likely undergo changes before then. We encourage you to take that into consideration as you explore. Before getting started, please read more about Twitter Developer Labs.
Still using v1?
This page documents the current version of this endpoints, however you can still reference the previous version. You should also check out our version migration guide and review our changelog.
Getting started with the hide replies endpoint
This guide will help you understand how your app can help people hide replies.
Before you can start, you will need the following:
- An approved developer account
- A registered Twitter developer app with “Read and Write” or “Read, Write, and Direct Messages” permissions
- To have activated the “Hide replies” preview in the Labs dashboard
- A way to retrieve a list of candidate replies to a Tweet to be considered for hiding. Our recommendation is to use the Account Activity API.
Authentication
Your app will be hiding replies on behalf of the author of the original Tweet. For this reason, requests must use OAuth 1.0a (also known as user-context authorization). This means that you must use the API key and secret of your Twitter developer app, as well as the Tweet owner's access token and access token secret to make a request to the endpoint. If you need to generate an access token and secret for the Tweet owner, you can do so with the 3-legged OAuth process.
Help users hide replies
Your app should consider various approaches to using the hide replies API, including suggesting replies to hide for your users; or automatically hiding replies that have a very high probability of being irrelevant for your users.
Useful apps often combine technologies so that they can be valuable to their users. The following example shows how to hide replies by using the Perspective API. This API is an artificial intelligence trained by Jigsaw, a unit within Google, to detect toxic comments. The application logic will work in the following way:
- It asks the user’s permission to read their Tweets and hide their replies.
- It uses the Account Activity API to detect incoming replies.
- It asks the Perspective API to give a “score” (a number between 0 and 1) that indicates how confident their algorithm is that a comment is similar to toxic comments it’s seen in the past. (Perspective does not store the text sent to the service).
- It calls Hide replies if the algorithm’s score is very high.
Strive for transparency
Because Perspective is not trained on actual Tweets, certain language nuances may cause this app to hide a reply that a user wants to remain unhidden. Regardless of the technology or the approach you use when designing your app, always make the best possible effort to ensure that your users understand what your app has hidden and can make changes.
- The best option is to always trust the user and to give them full control over their decisions. When this is not desirable, your app should use a very high confidence threshold to detect and hide Tweets.
- Not everybody uses the same words, and your app should be designed to avoid any bias. Be mindful of reclaimed words and slang that may lead to false positives.
- If you are training an artificial intelligence, consider adopting a model that closely reflects language often used on Twitter.
Additional resources
- Check out our API reference to learn more about what’s available.
- Learn more about the new Developer Labs on the "About Labs" page.
- Give feedback on Twitter Developer Labs.
- Tell us about your experience using the Twitter Developer Labs endpoints by filling out this survey.