← All projects
Social MediaUnited States·2024·1 month
Twitter/X DM Bot
Bot that direct messages a target list of Twitter/X users using the new v2 API — scraping usernames from an external source.
Overview
The client had a partially built Twitter DM bot but couldn't get it to work after Twitter's API migration to v2. I rewrote the integration to work with the new API.
What Was Built
- Reads target usernames from a text file
- Authenticates via Twitter API v2 with OAuth 1.0a
- Sends direct messages to each user with configurable message content
- Includes rate limit handling and retry logic to avoid account flags
Complexity
Twitter's v2 API has stricter rate limits and different auth flows than v1.1. Getting DM sending working correctly required proper token scoping and careful request pacing.
Tech stack
PythonTwitter API v2OAuthTweepy
★★★★★
"Very helpful, knowledgeable, and communicative. Super cool guy and helped me with a bot. Very appreciative of his efforts and would not hesitate to deal with again!"
— Monster Duck · United States