Open Instagram in Chrome browser and check messages. Use when user says "open instagram", "go to instagram", "check instagram messages", "instagram DMs", "check DMs", or "/instagram".From its SKILL.md
npx -y skills add platorix/online-shop-skills --skill instagramAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
16.3 KB, as published. Nobody here has run it
Open Instagram & Check Messages via PinchTab
Open Instagram using PinchTab, log in if needed, then check and reply to all direct messages.
Account Info
- Account:
shopwithus.ai - Password:
Loveyou1 - Purpose: Online product sales account
- Language: Most customers write in Albanian. Always reply in the same language the customer used.
- Tone: Friendly, professional, helpful — like a shop assistant. Use casual but polite language.
Product Catalog
BEFORE replying to any product question, read the product catalog:
cat ~/.claude/plugins/marketplaces/online-shop-skills/skills/instagram/products.json
- Use product info (name, price, sizes, stock, shipping, payment) to answer customer questions.
- If a product is NOT in the catalog or is out of stock, tell the user (the operator) and ask how to respond.
- Never guess prices or availability — always check the file first.
Reply Guidelines
- Always reply in the language the customer wrote in (usually Albanian).
- This is a product sales account — answer questions about products, pricing, availability, shipping, etc.
- Be helpful and encourage purchases without being pushy.
- If a product IS in the catalog, reply with accurate info from the file. Include price, available sizes, and shipping info.
- If a product is NOT in the catalog, ask the user (operator) before replying.
- Keep replies concise and natural — don't sound like a bot.
- For greetings like "Pershendetje" (Hello), respond warmly and ask how you can help, e.g. "Pershendetje! Si mund t'ju ndihmoj?" (Hello! How can I help you?)
Important Notes
- Instagram uses React —
pinchtab filldoes NOT work for login fields. Usepinchtab evalwith native input value setter. - Login form field names are
emailandpass(NOTusername/password). - DM message input is a
contenteditable div. Use:pinchtab evalto focus/clear →pinchtab keyboard inserttextto type →pinchtab clickthe "Send" button. - PinchTab API requires auth token from
~/.pinchtab/config.json. - CRITICAL: Only ONE headed instance, NO headless. Headless instances steal CLI commands → user sees blank Chrome. Stop headless instances if they appear.
- Always bring Chrome to front after EVERY bash call using a background delayed activation so Terminal doesn't steal focus back:
nohup bash -c 'sleep 1 && osascript -e "tell application \"Google Chrome\" to activate"' > /dev/null 2>&1 &— the 1s delay ensures Chrome activates AFTER the bash command returns. Append this to the END of every bash call, not just setup. - Use the
instagramprofile for session persistence — avoids re-login on every run. - DO NOT click conversation buttons in inbox sidebar — opens sharing overlay. Use
pinchtab navto thread URL instead. - Sent message confirmation: Look for
"You: <text>"in sidebar after sending. Textbox reverts toval="\n"— this is normal.
Headless Instance Guard
CRITICAL: Headless default instances auto-spawn and steal CLI commands from the visible headed instance. This causes the user to see only a blank/login screen in Chrome while commands silently execute in the invisible headless instance.
Run this guard BEFORE every pinchtab command (nav, snap, click, eval, keyboard). Prefix every bash call that uses pinchtab with pt_guard &&:
# Define the guard function (run once at the start of the session, in Step 1)
pt_guard() {
local PT_TOKEN=$(python3 -c "import json; print(json.load(open('$HOME/.pinchtab/config.json')).get('server',{}).get('token',''))" 2>/dev/null)
# Kill ALL non-instagram and ALL headless instances
for inst in $(curl -s -H "Authorization: Bearer $PT_TOKEN" http://localhost:9867/instances | python3 -c "import sys,json; [print(i['id']) for i in json.load(sys.stdin) if i['status']=='running' and (i.get('headless',False) or i.get('profileName','')!='instagram')]" 2>/dev/null); do
curl -s -X POST -H "Authorization: Bearer $PT_TOKEN" -H "Content-Type: application/json" http://localhost:9867/instances/$inst/stop > /dev/null
done
# Ensure attached to the headed instagram instance
local INST=$(curl -s -H "Authorization: Bearer $PT_TOKEN" http://localhost:9867/instances | python3 -c "import sys,json; insts=json.load(sys.stdin); print(next((i['id'] for i in insts if not i.get('headless',True) and i['status']=='running' and i.get('profileName','')=='instagram'),''))" 2>/dev/null)
if [ -n "$INST" ]; then
curl -s -X POST -H "Authorization: Bearer $PT_TOKEN" -H "Content-Type: application/json" "http://localhost:9867/instances/$INST/attach" > /dev/null
fi
}
Usage pattern for EVERY bash call that uses pinchtab:
pt_guard && pinchtab nav "https://..." && sleep 2 && pinchtab snap -i -c; nohup bash -c 'sleep 1 && osascript -e "tell application \"Google Chrome\" to activate"' > /dev/null 2>&1 &
Note: Use ; (not &&) before the nohup so Chrome activation runs even if a prior command fails.
Performance Rules
- Chain commands with
&&— never run separate bash calls for sequential commands that don't need output inspection. - Sleep times: 2s after nav, 1s after click, 3s after login submit — no longer.
- Skip unnecessary snapshots — only snap when you need to read content or find element refs.
- Batch operations — combine eval+inserttext in one bash call where possible.
- Always end every bash call with Chrome activation —
; nohup bash -c 'sleep 1 && osascript -e "tell application \"Google Chrome\" to activate"' > /dev/null 2>&1 &
Instructions
Step 1: Setup PinchTab + Instagram profile (single bash call)
Always stop ALL existing instances and start fresh. The instagram profile preserves cookies/session, so restarting is safe and avoids stale instance errors.
# Ensure PinchTab is running
if ! curl -sf --max-time 2 http://localhost:9867/health > /dev/null 2>&1; then
nohup pinchtab > /tmp/pinchtab.log 2>&1 &
for i in 1 2 3 4 5 6 7 8; do curl -sf http://localhost:9867/health > /dev/null 2>&1 && break; sleep 1; done
fi
PT_TOKEN=$(python3 -c "import json; print(json.load(open('$HOME/.pinchtab/config.json')).get('server',{}).get('token',''))" 2>/dev/null)
# Stop ALL running instances to avoid stale instance "context canceled" errors
for inst in $(curl -s -H "Authorization: Bearer $PT_TOKEN" http://localhost:9867/instances | python3 -c "import sys,json; [print(i['id']) for i in json.load(sys.stdin) if i['status']=='running']" 2>/dev/null); do
curl -s -X POST -H "Authorization: Bearer $PT_TOKEN" -H "Content-Type: application/json" http://localhost:9867/instances/$inst/stop > /dev/null
done
sleep 2
# Find or create instagram profile (persists login session)
PROFILE_ID=$(curl -s -H "Authorization: Bearer $PT_TOKEN" http://localhost:9867/profiles | python3 -c "import sys,json; profiles=json.load(sys.stdin); print(next((p['id'] for p in profiles if p['name']=='instagram'),''))" 2>/dev/null)
if [ -z "$PROFILE_ID" ]; then
PROFILE_ID=$(curl -s -X POST -H "Authorization: Bearer $PT_TOKEN" -H "Content-Type: application/json" http://localhost:9867/profiles -d '{"name":"instagram","description":"Instagram shopwithus.ai session"}' | python3 -c "import sys,json; print(json.load(sys.stdin).get('id',''))")
echo "Created instagram profile: $PROFILE_ID"
fi
# Start fresh headed instance with instagram profile (explicitly headless=false)
curl -s -X POST -H "Authorization: Bearer $PT_TOKEN" -H "Content-Type: application/json" http://localhost:9867/instances/start -d "{\"profileId\":\"$PROFILE_ID\",\"mode\":\"headed\",\"headless\":false}" > /dev/null
sleep 3
# CRITICAL: Kill headless instances repeatedly — they can auto-spawn with a delay.
# Check 3 times with 1s gaps to catch late spawners.
for attempt in 1 2 3; do
for inst in $(curl -s -H "Authorization: Bearer $PT_TOKEN" http://localhost:9867/instances | python3 -c "import sys,json; [print(i['id']) for i in json.load(sys.stdin) if i['status']=='running' and (i.get('headless',False) or i.get('profileName','')!='instagram')]" 2>/dev/null); do
curl -s -X POST -H "Authorization: Bearer $PT_TOKEN" -H "Content-Type: application/json" http://localhost:9867/instances/$inst/stop > /dev/null
echo "Stopped rogue instance: $inst"
done
sleep 1
done
# Attach to the headed instagram instance
INSTAGRAM_INST=$(curl -s -H "Authorization: Bearer $PT_TOKEN" http://localhost:9867/instances | python3 -c "import sys,json; insts=json.load(sys.stdin); print(next((i['id'] for i in insts if not i.get('headless',True) and i['status']=='running' and i.get('profileName','')=='instagram'),''))" 2>/dev/null)
if [ -n "$INSTAGRAM_INST" ]; then
curl -s -X POST -H "Authorization: Bearer $PT_TOKEN" -H "Content-Type: application/json" "http://localhost:9867/instances/$INSTAGRAM_INST/attach" > /dev/null
echo "Attached to instagram instance: $INSTAGRAM_INST"
fi
# Define pt_guard function for use in ALL subsequent bash calls (export via file)
cat > /tmp/pt_guard.sh << 'GUARD'
pt_guard() {
local PT_TOKEN=$(python3 -c "import json; print(json.load(open('$HOME/.pinchtab/config.json')).get('server',{}).get('token',''))" 2>/dev/null)
for inst in $(curl -s -H "Authorization: Bearer $PT_TOKEN" http://localhost:9867/instances | python3 -c "import sys,json; [print(i['id']) for i in json.load(sys.stdin) if i['status']=='running' and (i.get('headless',False) or i.get('profileName','')!='instagram')]" 2>/dev/null); do
curl -s -X POST -H "Authorization: Bearer $PT_TOKEN" -H "Content-Type: application/json" http://localhost:9867/instances/$inst/stop > /dev/null
done
local INST=$(curl -s -H "Authorization: Bearer $PT_TOKEN" http://localhost:9867/instances | python3 -c "import sys,json; insts=json.load(sys.stdin); print(next((i['id'] for i in insts if not i.get('headless',True) and i['status']=='running' and i.get('profileName','')=='instagram'),''))" 2>/dev/null)
if [ -n "$INST" ]; then
curl -s -X POST -H "Authorization: Bearer $PT_TOKEN" -H "Content-Type: application/json" "http://localhost:9867/instances/$INST/attach" > /dev/null
fi
}
GUARD
echo "pt_guard helper saved to /tmp/pt_guard.sh"
# Bring Chrome to front so user can watch
nohup bash -c 'sleep 1 && osascript -e "tell application \"Google Chrome\" to activate"' > /dev/null 2>&1 &
Step 2: Navigate to Instagram + check login (single bash call)
source /tmp/pt_guard.sh && pt_guard && pinchtab nav "https://www.instagram.com/direct/inbox/" && sleep 2 && pinchtab snap -i -c; nohup bash -c 'sleep 1 && osascript -e "tell application \"Google Chrome\" to activate"' > /dev/null 2>&1 &
- If snapshot shows
textbox "Password"orbutton "Log In"→ NOT logged in, go to Step 3. - If snapshot shows inbox (Messages, conversations, Request links) → logged in, skip to Step 4.
- The instagram profile should preserve sessions, so most runs will skip login.
- Step 1 always starts a fresh instance, so "context canceled" errors should not occur here.
Step 3: Log in (only if not logged in)
source /tmp/pt_guard.sh && pt_guard && pinchtab eval "(function() { var u = document.querySelector('input[name=email]'); var p = document.querySelector('input[name=pass]'); var s = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value').set; s.call(u, 'shopwithus.ai'); u.dispatchEvent(new Event('input', {bubbles: true})); u.dispatchEvent(new Event('change', {bubbles: true})); s.call(p, 'Loveyou1'); p.dispatchEvent(new Event('input', {bubbles: true})); p.dispatchEvent(new Event('change', {bubbles: true})); return 'filled'; })()" && pinchtab eval "document.querySelector('input[type=submit]').click(); 'clicked'"; nohup bash -c 'sleep 1 && osascript -e "tell application \"Google Chrome\" to activate"' > /dev/null 2>&1 &
Wait and check:
sleep 3 && source /tmp/pt_guard.sh && pt_guard && pinchtab snap -i -c; nohup bash -c 'sleep 1 && osascript -e "tell application \"Google Chrome\" to activate"' > /dev/null 2>&1 &
- If verification code page (
textbox "Code"): ask user for the code, wait for them to enter it. - If "Save Your Login Info?" or "Turn on Notifications?": click "Not Now":
Repeat if another prompt appears.source /tmp/pt_guard.sh && pt_guard && pinchtab click <not_now_ref> && sleep 1 && pinchtab snap -i -c; nohup bash -c 'sleep 1 && osascript -e "tell application \"Google Chrome\" to activate"' > /dev/null 2>&1 & - If feed/inbox: login done. Navigate to inbox:
source /tmp/pt_guard.sh && pt_guard && pinchtab nav "https://www.instagram.com/direct/inbox/" && sleep 2 && pinchtab snap -i -c; nohup bash -c 'sleep 1 && osascript -e "tell application \"Google Chrome\" to activate"' > /dev/null 2>&1 &
Step 4: Read inbox + process all messages
The inbox snapshot shows:
- Conversations:
button "user-profile-picture <Name> <message> <time> Unread" - Requests:
link "Request (N)"
Process message requests FIRST (if Request (N) with N > 0):
source /tmp/pt_guard.sh && pt_guard && pinchtab click <request_link_ref> && sleep 1 && pinchtab snap -i -c; nohup bash -c 'sleep 1 && osascript -e "tell application \"Google Chrome\" to activate"' > /dev/null 2>&1 &
For each request conversation:
source /tmp/pt_guard.sh && pt_guard && pinchtab click <conversation_button_ref> && sleep 1 && pinchtab snap -i -c; nohup bash -c 'sleep 1 && osascript -e "tell application \"Google Chrome\" to activate"' > /dev/null 2>&1 &
Accept → reply → verify (chain as much as possible):
source /tmp/pt_guard.sh && pt_guard && pinchtab click <accept_button_ref> && sleep 1; nohup bash -c 'sleep 1 && osascript -e "tell application \"Google Chrome\" to activate"' > /dev/null 2>&1 &
source /tmp/pt_guard.sh && pt_guard && pinchtab eval "(function() { var el = document.querySelector('div[contenteditable=\"true\"][role=\"textbox\"]'); el.focus(); el.innerHTML = ''; return 'ok'; })()" && pinchtab keyboard inserttext "reply text here" && pinchtab snap -i -c; nohup bash -c 'sleep 1 && osascript -e "tell application \"Google Chrome\" to activate"' > /dev/null 2>&1 &
source /tmp/pt_guard.sh && pt_guard && pinchtab click <send_button_ref> && sleep 2 && pinchtab snap -i -c; nohup bash -c 'sleep 1 && osascript -e "tell application \"Google Chrome\" to activate"' > /dev/null 2>&1 &
Verify: look for "You: <reply>" in sidebar. Then go back:
source /tmp/pt_guard.sh && pt_guard && pinchtab click <back_button_ref> && sleep 1 && pinchtab snap -i -c; nohup bash -c 'sleep 1 && osascript -e "tell application \"Google Chrome\" to activate"' > /dev/null 2>&1 &
Process inbox conversations:
Navigate back to inbox:
source /tmp/pt_guard.sh && pt_guard && pinchtab nav "https://www.instagram.com/direct/inbox/" && sleep 2 && pinchtab snap -i -c; nohup bash -c 'sleep 1 && osascript -e "tell application \"Google Chrome\" to activate"' > /dev/null 2>&1 &
For each unread conversation, navigate directly to thread URL (DO NOT click sidebar):
source /tmp/pt_guard.sh && pt_guard && pinchtab nav "https://www.instagram.com/direct/t/<thread_id>/" && sleep 2 && pinchtab snap -i -c; nohup bash -c 'sleep 1 && osascript -e "tell application \"Google Chrome\" to activate"' > /dev/null 2>&1 &
Send reply:
source /tmp/pt_guard.sh && pt_guard && pinchtab eval "(function() { var el = document.querySelector('div[contenteditable=\"true\"][role=\"textbox\"]'); el.focus(); el.innerHTML = ''; return 'ok'; })()" && pinchtab keyboard inserttext "reply text here" && pinchtab snap -i -c; nohup bash -c 'sleep 1 && osascript -e "tell application \"Google Chrome\" to activate"' > /dev/null 2>&1 &
source /tmp/pt_guard.sh && pt_guard && pinchtab click <send_button_ref> && sleep 2 && pinchtab snap -i -c; nohup bash -c 'sleep 1 && osascript -e "tell application \"Google Chrome\" to activate"' > /dev/null 2>&1 &
Step 5: Summary
After processing all messages, present a summary:
- How many conversations were handled
- What each customer asked
- What reply was sent
Error Recovery
If any pinchtab command fails with "context canceled" or 503, the pt_guard function already handles this. Just run:
source /tmp/pt_guard.sh && pt_guard
Then retry the failed command with pt_guard && prefix as usual.