Automatically monitor and log fan counters from social media(Facebook Pages, Twitter, Instagram, YouTube, Google+, OneSignal, Alexa) using APIs to Google Spreadsheet. Very useful for website admins and social media managers.
git clone https://github.com/adam0white/Social-Media-Monitor.gitAutomatically monitor and log fan counters from social media(Facebook Pages, Twitter, Instagram, YouTube, Google+, OneSignal, Alexa) using APIs to Google Spreadsheet. Very useful for website admins and social media managers.
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/adam0white/Social-Media-MonitorCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Create a Google Apps Script to monitor and log fan counters from social media platforms (Facebook Pages, Twitter, Instagram, YouTube, Google+, OneSignal, Alexa) using their APIs. The script should update a Google Spreadsheet with the latest follower counts every [FREQUENCY] (e.g., daily, weekly). Include error handling for API rate limits and ensure the script can handle [NUMBER] of social media accounts. Provide the complete script code and instructions for setup.
```javascript
// Social Media Monitor Script
function monitorSocialMedia() {
// Define social media platforms and their API endpoints
const platforms = {
facebook: {
url: 'https://graph.facebook.com/v12.0/[PAGE_ID]/insights/page_fan_counts',
apiKey: '[FACEBOOK_API_KEY]'
},
twitter: {
url: 'https://api.twitter.com/2/users/[USER_ID]',
apiKey: '[TWITTER_API_KEY]'
},
// Add other platforms similarly
};
// Open the Google Spreadsheet
const sheet = SpreadsheetApp.openById('[SPREADSHEET_ID]').getActiveSheet();
// Loop through each platform and fetch follower counts
for (const [platform, config] of Object.entries(platforms)) {
const options = {
headers: {
'Authorization': `Bearer ${config.apiKey}`
}
};
try {
const response = UrlFetchApp.fetch(config.url, options);
const data = JSON.parse(response.getContentText());
const followerCount = data.[PLATFORM_SPECIFIC_FIELD]; // e.g., data.followers_count for Twitter
// Log the data to the spreadsheet
sheet.appendRow([new Date(), platform, followerCount]);
} catch (error) {
console.error(`Error fetching data from ${platform}: ${error.toString()}`);
}
}
}
```
### Instructions for Setup
1. **Create a Google Spreadsheet**: Set up a new Google Spreadsheet to log the follower counts.
2. **Enable Google Apps Script**: Open the script editor from the Extensions menu in Google Sheets.
3. **Paste the Script**: Copy the provided script into the script editor.
4. **Replace Placeholders**: Update the placeholders (e.g., `[FACEBOOK_API_KEY]`, `[SPREADSHEET_ID]`) with your actual API keys and spreadsheet ID.
5. **Set Up Triggers**: Create a time-driven trigger to run the script at your desired frequency (e.g., daily).
6. **Test the Script**: Run the script manually to ensure it works correctly and logs data to your spreadsheet.