August 20, 2025
Brand monitoring on social media shouldn't require expensive enterprise tools or complex API integrations. Yet most solutions today demand both, leaving many teams to manually search platforms or go without crucial mention tracking. If you’re looking for a home grown solution that can be modified for your business workflows, read on to learn how to build a simple Anchor Browser-powered solution. By the end, you’ll be able to automatically monitor X (also known as Twitter), save new posts in a Google Sheet, and send posts downstream to any tool of your choice.
What You'll Build
A Ruby script that:
Searches X for specific keywords using Anchor Browser's AI agents
Extracts post data (URL, author, content) from search results
Saves new posts to a Google Sheet with post de-duplication
Sends webhook notifications for downstream automation (Slack, email, etc.)
Key Features
AI-powered monitoring
Anchor Browser's agentic browsers handle complex Twitter authentication and data extraction without brittle selectors.
Smart Duplicate Prevention
Checks all existing post IDs in the spreadsheet, not just the last processed post.
Webhook Integration
Enables downstream automation through HTTP requests to services like Slack, Discord, Zapier, IFTTT, Pipedream, or custom endpoints.
Modifiable Workflows
Built as readable Ruby classes that you can easily adapt for different keywords, platforms, or data destinations.
Getting Started
Prerequisites
Ruby 2.7+ installed
Anchor Browser account and API key
Google Cloud account with Sheets API access
X (Twitter) account for authenticating an agentic browser profile
Clone and Setup
Clone the repository and install dependencies:
How it Works
Anchor Browser Remote Browser Session
Anchor Browser handles the complex parts, such as authentication, navigation, and data extraction through AI agents:
Smart Duplicate Prevention
Before saving posts, the bot checks all existing entries in your spreadsheet:
Optional: Downstream Destination Output
Send new mentions to any service via webhooks for instant notifications:
Connect to Zapier, Slack, Discord, or any HTTP endpoint to trigger alerts, update dashboards, or feed other business systems.
Running the Bot
First, create your X profile in Anchor Browser:
Start a new session and navigate to https://x.com
Log in with your X account
Save the browser profile in the Anchor Browser playground
Set your profile name to the environment variable,
ANCHOR_PROFILE_NAME
Then set up your Google Sheet:
Create a new Google Spreadsheet:
Copy the spreadsheet ID from the URL
Set your Google sheet ID to
GOOGLE_SHEETS_ID
Create a service account in Google Cloud Console
Download the JSON key and base64 encode it:
base64 -i service-account.json
Set your base64-encoded service account key to
GOOGLE_SERVICE_ACCOUNT_JSON
Share your spreadsheet with the service account email
And finally set your API key for Anchor Browser:
Go to the Anchor Browser cloud app
Navigate to the API Keys page
Copy your API key and set your variable,
ANCHOR_API_KEY
Your environment variables should look as follows:
Test run:
ruby main.rb
You'll see log output that steps you through the program's execution flow and indicators of any available results.
Automated Monitoring
For continuous mention monitoring, deploy as a scheduled function using a cloud service provider of your choice.
Conclusion
You now have a fully automated brand monitoring system that runs continuously in the cloud, costs pennies to operate, and can be modified to fit your exact business needs. As new mentions appear on X, they'll automatically flow into your Google Sheet and trigger any downstream workflows you've configured—giving you real-time visibility into your brand's social media presence without the overhead of enterprise monitoring tools.
Have any questions on how to stand this up for your brand or have other ideas for your business? Feel free to reach out to us and we'll be glad to help.