Skill: yadavabhijeet4/golden-rule (version 1.0.0)

--- name: golden-hour description: Automates the "Golden Hour" Instagram engagement hack. Use this skill when a user wants to set up a bot that watches an Instagram Reel/Post for a specific keyword in the comments (like "BOT" or "GOLDEN") and automatically replies to the comment and sends a DM with a link or message. --- # Golden Hour Automator This skill provides the script and instructions needed to run a comment-to-DM automation on Instagram. It is designed to boost engagement in the critical first hour (the "Golden Hour") after a post goes live. ## Prerequisites The user must have: 1. An Instagram Professional/Business account linked to a Facebook Page. 2. A Long-Lived Instagram Graph API Page Access Token (`IG_ACCESS_TOKEN`). 3. Their Instagram Business Account ID (`IG_ACCOUNT_ID`). Ensure these are set in the environment or `.env` file before running the script. ## Usage When a user asks to monitor a post for a keyword and send a DM, run the included `ig_golden_hour.py` script. ```bash uv run {baseDir}/scripts/ig_golden_hour.py \ --media_id "12345678901234567" \ --keyword "bot" \ --dm_text "Here is the link you requested: https://example.com" \ --duration 60 ``` ### Parameters: - `--media_id`: The ID of the specific Instagram post/Reel to monitor. (You may need to query the Graph API `me/media` endpoint to find this for the user's latest post). - `--keyword`: The trigger word the script watches for in the comments (case-insensitive). - `--dm_text`: The exact message to send to the user's DMs. - `--duration`: How many minutes the script should stay alive and monitor the post (default is 60). ### What the Script Does: 1. Polls the comments of the specified `media_id` every 2 minutes. 2. If it finds the `--keyword`, it sends the `--dm_text` directly to the commenter's inbox using the Meta `me/messages` endpoint. 3. It posts a public reply to the comment ("Just sent you a DM with the link! 🚀") to double the post's comment count and boost algorithmic reach. 4. It sends a success notification back to OpenClaw via the `openclaw message` CLI.

path: scripts/ig_golden_hour.py
content: # /// script
# dependencies = ["requests"]
# ///
import os
import time
import requests
import argparse

def golden_hour_monitor(media_id, keyword, dm_text, duration_minutes=60):
    [REDACTED_SECRET]"IG_ACCESS_TOKEN")
    account_id = os.environ.get("IG_ACCOUNT_ID")
    
    if not token or not account_id:
        print("🚨 Error: Missing IG_ACCESS_TOKEN or IG_ACCOUNT_ID.")
        return

    print(f"🕵️‍♂️ Starting Golden Hour Monitor on Post ID: {media_id}")
    print(f"🕒 Monitoring for exactly {duration_minutes} minutes.")
    print(f"🎯 Keyword Trigger: '{keyword}'")
    
    # Store replied comment IDs
    processed_comments = set()
    start_time = time.time()
    
    while (time.time() - start_time) < (duration_minutes * 60):
        try:
            url = f"https://graph.facebook.com/v19.0/{media_id}/comments"
            params = {
                'access_token': token,
                'fields': 'id,text,from'
            }
            response = requests.get(url, params=params)
            comments = response.json().get('data', [])
            
            for comment in comments:
                c_id = comment.get('id')
                c_text = comment.get('text', '').lower()
                
                if c_id not in processed_comments and keyword.lower() in c_text:
                    print(f"🚨 Keyword Detected! Processing comment: '{c_text}'")
                    
                    # 1. Send the Private DM Reply
                    print(f"📨 Sliding into DMs: {dm_text}")
                    payload = { "recipient": { "comment_id": c_id }, "message": { "text": dm_text }, "access_token": token }
                    requests.post(f"https://graph.facebook.com/v19.0/me/messages", json=payload)
                    
                    # 2. Reply publicly to double the engagement
                    print(f"💬 Replying publicly to the comment ID: {c_id}")
                    payload_reply = { "message": "Just sent you a DM with the link! 🚀", "access_token": token }
                    requests.post(f"https://graph.facebook.com/v19.0/{c_id}/replies", data=payload_reply)
                    
                    # 3. Notify Neo (OpenClaw)
                    try:
                        os.system(f"openclaw message send --target webchat --message '🚨 SUCCESS! I just sent the Mock Trading DM to an Instagram user who commented \"BOT\".'")
                    except:
                        pass
                    
                    processed_comments.add(c_id)
            
        except Exception as e:
            print(f"Error querying Graph API: {e}")
        
        # Poll every 2 minutes
        time.sleep(120)
        
    print(f"✅ Golden Hour Monitor finished successfully! Replying to {len(processed_comments)} targeted comments.")

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Instagram Golden Hour Engagement Automator")
    parser.add_argument("--media_id", type=str, required=True, help="The Instagram Media ID to monitor.")
    parser.add_argument("--keyword", type=str, default="interested", help="The keyword to trigger the DM.")
    parser.add_argument("--dm_text", type=str, required=True, help="The text payload you want to DM the user.")
    parser.add_argument("--duration", type=int, default=60, help="Minutes to run the watcher.")
    args = parser.parse_args()
    
    golden_hour_monitor(args.media_id, args.keyword, args.dm_text, args.duration)


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (CRITICAL)