Automated Snapchat streak maintenance using Selenium WebDriver
A Java-based automation tool that programmatically maintains Snapchat streaks through browser automation. Built out of necessity when manually sending daily snaps to 20+ friends became unsustainable.
Like every 21 year old, I got overwhelmed with responsiblities and kept forgetting the yellow app.
Snapchat streaks require sending snaps to friends every 24 hours. Miss a day? Lose a streak you've maintained for months (or years). With multiple streaks to maintain, this becomes a daily chore that takes 5-10 minutes of mindless tapping.
This bot automates the entire flow:
- Logs into Snapchat Web
- Handles dynamic modals and popups
- Accesses the camera (using a fake media stream)
- Takes a snap
- Selects all streak contacts
- Sends the snap
Result: What took 10 minutes of manual work now runs in ~2 minutes, completely unattended.
| Technology | Purpose |
|---|---|
| Java 17 | Core application logic |
| Selenium WebDriver | Browser automation and DOM interaction |
| Maven | Dependency management and build lifecycle |
| Docker | Containerized deployment with multi-stage builds |
| Chrome Headless | Undetectable browser automation |
The API uses method chaining for readable, expressive automation flows:
streaker.open()
.login(email, password)
.checkForModals()
.camera()
.snap()
.streak()
.send()
.log()
.quit();Modern websites detect and block Selenium. This implementation bypasses detection through:
- Custom User-Agent strings mimicking real browsers
- Disabling the
AutomationControlledBlink feature - Excluding automation switches from Chrome options
- Fake media stream injection for camera access
options.addArguments("--disable-blink-features=AutomationControlled");
options.setExperimentalOption("excludeSwitches", List.of("enable-automation"));
options.addArguments("--use-fake-device-for-media-stream");Web UIs change frequently. The bot uses retry loops with implicit waits to handle dynamic content loading:
while (true) {
try {
element = driver.findElement(By.className("targetClass"));
element.click();
break;
} catch (Exception e) {
driverWait(2000);
}
}Multi-stage Docker build keeps the final image lean:
- Stage 1 (Builder): Maven image compiles and packages the JAR
- Stage 2 (Runtime): JRE-only image with Chrome installed
FROM maven:3.9-eclipse-temurin-17 AS builder
# Build the fat JAR...
FROM eclipse-temurin:17-jre-jammy
# Install Chrome, copy JAR, runstreaker/
├── src/main/java/com/nifemi/
│ └── Streaker.java # Main automation logic
├── pom.xml # Maven config with shade plugin
├── Dockerfile # Multi-stage containerized build
└── .gitignore
- Java 17+
- Maven 3.x
- Chrome browser (or Docker)
-
Create a
creds.txtfile with your credentials:your_email your_password -
Build and run:
mvn clean package java -jar target/streaker-1.0-SNAPSHOT.jar
docker build -t snap-streaker .
docker run snap-streaker- Browser automation at scale: Handling dynamic SPAs requires patience and defensive coding
- Anti-bot detection: Understanding how sites fingerprint automation tools
- Headless browser quirks: Fake media streams, viewport sizes, and permission handling
- Docker multi-stage builds: Separating build-time and runtime dependencies
This project was built for educational purposes and personal use. Automating interactions with third-party services may violate their Terms of Service. Use responsibly.
Nifemi Akejuobi
Built because maintaining 20+ streaks manually every single day was getting old. 🙃