This is against Twitter ToS:
“ You may send automated Direct Messages to users so long as:
- in advance of sending the Direct Message, the recipient(s) have requested or have clearly indicated an intent on Twitter to be contacted by you via Direct Message, for example by sending you a Direct Message;
- and you provide a clear and easy way for such users to opt-out of receiving automated Direct Messages, and promptly honor all such opt-out requests.
The fact that a user is technically able to receive a Direct Message from you (e.g. because the user follows you, has enabled the ability to receive Direct Messages from any account, or because the user is in a pre-existing Direct Message conversation with you) does not necessarily mean they have requested or expect to receive automated Direct Messages from you.”
https://help.twitter.com/en/rules-and-policies/twitter-autom...