Twitter APIの申請が通らない！！！！


# 初めに
**Twitter**の**API**を利用してデータ分析（感情分析）をしたい！というモチベーションで**TwitterAPI**というものを調べていきました。具体的な申請の仕方などは他の記事や、私が後日書く記事を見てください！

# ではここでは何を書くのか？
TwitterAPIの利用申請は簡単な方と難しい方があると個人的に思っています（←TwitterAPI始めたばかりなので今後内容をアップデートしていきます）。簡単な方は**Essential**、難しい方は**Elevated**だと思います。。さて本題に入りましょう。なぜ私がこのように感じたのか？
>>>>>>***Twitter API（Elevated）の申請が通らない！！！！(T . T)***

ということで、表題の通りなんですが、Twitter APIの申請が通らない事案が発生しまして、苦労したのでここにまとめておきます（2022/1/18時点）。**時間がある方・もしくは同じくTwitter APIの申請が通らない方**はご参考までに読んでいってください。
**私が提出した申請文書を以下にメモしておきます。**

# 最初の申請

How will you use the T witter API or Twitter Data?
In your words
In English, please describe how you plan to use Twitter data and/or APIs. The more detailed the response, the easier it is to review and approve.

:::note info
I would like to use it to learn python and API. Specifically, the goal is to use BERT to determine whether the data obtained is negative or positive content. I also want to use it to learn the API. I will never do anything that will cause trouble for others.
:::

The specifics

Please answer each of the following with as much detail and accuracy as possible. Failure to do so could result in delays to your access to Twitter developer platform or rejected applications.

Are you planning to analyze Twitter data?

Yes
Please describe how you will analyze Twitter data including any analysis of Tweets or Twitter users.

:::note info
I want to determine whether the data obtained is negative or positive content by BERT. Also, I want to grow more by doing all the processes of aggregating, processing, visualizing, and analyzing text data by myself.
:::

Will your app use Tweet, Retweet, Like, Follow, or Direct Message functionality?

Yes
Please describe your planned use of these features.

:::note info
I have no plans to use it now but may in the future. Of course, I will never use it to cause trouble for others or to spam.
:::

Do you plan to display Tweets or aggregate data about Twitter content outside Twitter?

Yes
Please describe how and where Tweets and/or data about Twitter content will be displayed outside of Twitter.

:::note info
I don't plan to use it now, but I may introduce it in my blog in the future.
If I do use it, I will process it so that no individual is identified before posting it.
:::

**私の場合は大体5~6時間で返信が来ました。返信の内容は以下のメールになります（2回目の申請）。**

# 2回目の申請

### Twitterからのメール

Hello,

Thanks for your interest in building on Twitter. 

Before we can finish our review of your developer account application, we need some more details about your use case. 

The types of information that are valuable for our review include:
The core use case, intent, or business purpose for your use of the Twitter APIs.
If you intend to analyze Tweets, Twitter users, or their content, share details about the analyses you plan to conduct, and the methods or techniques. 
If your use involves Tweeting, Retweeting, or liking content, share how you’ll interact with Twitter accounts, or their content.
If you’ll display Twitter content off of Twitter, explain how, and where, Tweets and Twitter content will be displayed with your product or service, including whether Tweets and Twitter content will be displayed at row level, or aggregated.
Just reply to this email with these details. Once we’ve received your response, we’ll continue our review. We appreciate your help! 

Thanks, 

Twitter

**もう少し具体的に書く必要がありそうです。。。では、私の2回目の返信を見てみましょう。**

### 私の返信内容

:::note info
Hello.

Thank you for sending me a message.

The core use case, intent, or business purpose for your use of the Twitter APIs.
・Basically, I will use it to learn to improve my skills. (1) I want to find out how many tweets of a specific keyword have been tweeted in a specific period on Twitter. (2) I would like to do sentiment analysis in BERT. (3) I want to classify the obtained data into regional characteristics to make sales forecasts, etc. If the analysis is good, we might share the results in an internal study session.

If you intend to analyze Tweets, Twitter users, or their content, share details about the analyses you plan to conduct, and the methods or techniques. 
・I would like to visualize how the new coronavirus has affected people's emotions in the world by conducting a time series of sentiment analyses using BERT. Also, by analyzing word-of-mouth about a certain product (cosmetics or whatever), I want to analyze whether the product is popular or unpopular. Other than that, I would like to use Python to obtain regional trends in order to study marketing, and gain skills to aggregate and visualize the data. Basically, I will use Python and Pandas, Numpy, and scikit-learn to analyze data. For sentiment analysis and processing, I use natural language processing (BERT, Seq2Seq, ELMo, etc.). The environment we will use is M1 Mac with Jupyter lab or Google Colaboratory.

If your use involves Tweeting, Retweeting, or liking content, share how you’ll interact with Twitter accounts or their content.
・I don't plan to use it now, but I may use it when I create a program like that tweets the weather forecast retrieved by the API on time every day. Of course, this is just for my own learning. I will not use it for spamming purposes.

If you’ll display Twitter content off of Twitter, explain how, and where, Tweets and Twitter content will be displayed with your product or service, including whether Tweets and Twitter content will be displayed at the row level, or aggregated.
・I don't have any details in mind at the moment, but I think I will include it as a string in my technology portfolio. I might also write and discuss the results of the data analysis on my blog. I haven't written about it at all yet, but in the meantime, I will include the URL of my blog. (https://seiji-tanimoto.ghost.io)

Please continue with your reviews.
Thank you.
:::

**具体的にはなりましたが、TwitterAPI(Elevated)に必要な項目を満たしていなかったようです。ネットサーフィンで他の方のブログなどを調べたところ、3回目の申請はラストチャンス？？らしいので次は本気で書きます。**

# 3回目の申請

### Twitterからのメール

Hello,

Thanks for your response. We still need some more details for our review of your Twitter developer account application. 

The information we still need includes: 
The core use case, intent, or business purpose for your use of the Twitter APIs.
Please note, “business purpose” in this context includes uses not necessarily connected to a commercial business. We require information about the problem, user story, or the overall goal your use of Twitter content is intended to address.
If you are a student, learning to code, or just getting started with the Twitter APIs, please provide details about potential projects, or areas of focus.
If you intend to analyze Tweets, Twitter users, or their content, please share details about the analyses you plan to conduct, and the methods or techniques.
Note that “analyze” in this context includes any form of processing performed on Twitter content. Please provide as detailed and exhaustive an explanation as possible of your intended use case.
If your use involves Tweeting, Retweeting, or liking content, share how you will interact with Twitter users or their content.
If you’ll display Twitter content off of Twitter, please explain how, and where, Tweets and Twitter content will be displayed to users of your product or service, including whether Tweets and Twitter content will be displayed at row level, or aggregated.
To provide the information, please respond to this email. Where possible, please share links to illustrations, or sample work products. 

And keep in mind, we can’t view attachments. 

If we don’t receive the information we need, your application will not be accepted. 

We appreciate your help!

Thanks, 

Twitter


### 私の返信内容（以下、申請が通った内容になります）

:::note info
Hi!I rewrote the application text to be more specific, so please take a look at it.


【Questions： The core use case, intent, or business purpose for your use of the Twitter APIs.】

My answer： I’m learning Machine Learning, Deep Learning, text-mining, and natural language processing with Python. So, I want to practice these skills by analyzing tweets. To be specific, I want to analyze tweets about regional trends. The purpose of my service is that I plan to look for products, sweets, and local delicacies that are selling well in each region. For example, how long has my favorite salad chicken been popular, and is it still popular? And I would like to quantitatively evaluate those evaluations with emotional analysis. I think it would be interesting if I could use regression analysis to predict which products are likely to sell next, based on the past trends.

【Questions： If you intend to analyze Tweets, Twitter users, or their content, please share details about the analyses you plan to conduct, and the methods or techniques.】

My answer： if I use salad chicken as an example. first, I'm going to use hashtags to gather information. Second,  I will plan to manage the collected data with AWS. Thirdly, I'm thinking of extracting words from tweets. Fourthly. I'm going to do sentiment analysis on the data obtained. Finally, I will compare and discuss the products that have been popular in the past and those that have been popular recently. I will also predict which products are likely to become popular in the future and I will buy those products myself.

【Questions： If your use involves Tweeting, Retweeting, or liking content, share how you will interact with Twitter users or their content.】

My answer： Yes, I'm planning to analyze the data retrieved by the API and tweet about what I find interesting. I would also like to create a bot that tweets regularly in a different way. Specifically, BERT will automatically create and tweet reviews about the latest popular convenience store sweets. I hope this will make you more interested in machine learning and natural language processing. Of course, I will take the utmost care not to bother others.
I will not automate likes.
I will not automate retweets.
I will not automate following and unfollowing.
I will not automate adding to lists or collections.

【Questions： If you’ll display Twitter content off of Twitter, please explain how, and where, Tweets and Twitter content will be displayed to users of your product or service, including whether Tweets and Twitter content will be displayed at the row level, or aggregated.】

My answer： I will write articles about the data on my website (https://seiji-tanimoto.ghost.io). The article will consist of 4 sections. The first section is an introduction and a background about the analysis. The second section is a procedure. The section includes how to collect tweets, why select sentiment analysis. The third section is the result. The final section is a discussion. Of course, the data will be processed so that individuals are not identified. No spamming. I pledge not to provide any content that makes others feel uncomfortable. I also want to use APIs and data with great care to avoid offensive or confusing content.

Anyway, here's how it looks now. Hopefully, I can analyze my favorite foods and local trends.
Thank you for reading.
:::

![スクリーンショット 2022-01-18 9.01.11.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/896292/eac2cb60-6b73-285d-ea25-eba2b0297146.png)

# まとめ
まー最初からちゃんと書きなさいって感じですね^^;
以下の点は注意して申請した方が良いと感じました。
【注意点】

+ 主語の統一（I, We など）
+ [自動化ルール](https://help.twitter.com/ja/rules-and-policies/twitter-automation)を参考に書くといいかもしれません
+ 初めから丁寧に書く（←すみませんでした）

ちゃんと申請が通ったので、これからはデータ分析をしっかり頑張っていきます！（←絶対楽しい）
この記事がTwitterAPIの利用を始めることに役立てば嬉しいです。

# 参考資料

> [自動化ルール](https://help.twitter.com/ja/rules-and-policies/twitter-automation)