Instagram Api
by @lifeissea
Post to Instagram (Feed, Story, Reels, Carousel) and Threads using the official Meta Graph API. Requires Imgur for media hosting.
clawhub install instagram-api๐ About This Skill
name: Instagram API description: Post to Instagram (Feed, Story, Reels, Carousel) and Threads using the official Meta Graph API. Requires Imgur for media hosting. version: 1.1.1 author: raon requires_env: - INSTAGRAM_ACCESS_TOKEN - INSTAGRAM_BUSINESS_ACCOUNT_ID - IMGUR_CLIENT_ID
instagram-api
Meta Graph API๋ฅผ ์ฌ์ฉํด Instagram๊ณผ Threads์ ์ง์ ํฌ์คํ ํ๋ ์คํฌ. ๋ฏธ๋์ด ํธ์คํ ์ Imgur API๋ฅผ ์ฌ์ฉ (์ด๋ฏธ์ง/์์ ๊ณต๊ฐ URL ์์ฑ).
Imgur Client ID ๋ฐ๊ธ
Instagram Graph API๋ ๊ณต๊ฐ URL๋ก๋ง ๋ฏธ๋์ด๋ฅผ ์ ๋ก๋ํ ์ ์์ด Imgur๊ฐ ํ์ํฉ๋๋ค.
1. https://api.imgur.com/oauth2/addclient ์ ์
2. Application name: ์ํ๋ ์ด๋ฆ (์: raon-instagram)
3. Authorization type: Anonymous usage without user authorization ์ ํ
4. Authorization callback URL: https://localhost (Anonymous์ด๋ฏ๋ก ํ์๋ง ๋ง์ถ๋ฉด ๋จ)
5. ์ด๋ฉ์ผ ์
๋ ฅ ํ ์ ์ถ โ Client ID ํ์ธ
6. ํ๊ฒฝ๋ณ์ ์ค์ :
export IMGUR_CLIENT_ID="your_client_id_here"
ํ๊ฒฝ๋ณ์ ์ค์
# ~/.openclaw/.env ๋๋ ~/.zshrc์ ์ถ๊ฐ
export INSTAGRAM_ACCESS_TOKEN="your_token_here"
export INSTAGRAM_BUSINESS_ACCOUNT_ID="your_account_id_here"Threads (์ ํ)
export THREADS_ACCESS_TOKEN="your_threads_token_here"
export THREADS_USER_ID="your_threads_user_id_here"Imgur (์ด๋ฏธ์ง ํธ์คํ
์ฉ โ ํผ๋/๋ฆด์ค ์
๋ก๋ ์ ํ์)
export IMGUR_CLIENT_ID="your_imgur_client_id_here"
Meta Graph API ํ ํฐ ๋ฐ๊ธ
1. Meta for Developers ์ ์
2. ์ฑ ์์ฑ โ Business ์ ํ ์ ํ
3. Instagram Graph API ์ ํ ์ถ๊ฐ
4. ๊ถํ ์์ฒญ:
- instagram_basic
- instagram_content_publish
- pages_read_engagement
5. Access Token ๋ฐ๊ธ:
- Graph API Explorer: https://developers.facebook.com/tools/explorer/
- ์ฅ๊ธฐ ํ ํฐ(Long-lived token)์ผ๋ก ๊ตํ: 60์ผ ์ ํจ
6. Business Account ID ํ์ธ:
curl "https://graph.facebook.com/v21.0/me/accounts?access_token=YOUR_TOKEN"
> ๐ก Imgur Client ID: https://api.imgur.com/oauth2/addclient (Anonymous usage ์ ํ)
์คํฌ๋ฆฝํธ ์ฌ์ฉ๋ฒ
ํผ๋ ํฌ์คํ
bash scripts/post-feed.sh <์ด๋ฏธ์ง๊ฒฝ๋ก> <์บก์
ํ์ผ>์์
bash scripts/post-feed.sh ./photo.jpg ./caption.txt
์คํ ๋ฆฌ ํฌ์คํ
bash scripts/post-story.sh <์ด๋ฏธ์ง๊ฒฝ๋ก>์์
bash scripts/post-story.sh ./story.jpg
๋ฆด์ค ํฌ์คํ
bash scripts/post-reels.sh <์์๊ฒฝ๋ก> <์บก์
ํ์ผ>์์
bash scripts/post-reels.sh ./reel.mp4 ./caption.txt
์บ๋ฌ์ ํฌ์คํ
bash scripts/post-carousel.sh <์บก์
ํ์ผ> <์ด๋ฏธ์ง1> <์ด๋ฏธ์ง2> [์ด๋ฏธ์ง3...]์์
bash scripts/post-carousel.sh ./caption.txt ./img1.jpg ./img2.jpg ./img3.jpg
Threads ํฌ์คํ
bash scripts/post-threads.sh <์บก์
ํ์ผ> [์ด๋ฏธ์งURL]์์ (ํ
์คํธ๋ง)
bash scripts/post-threads.sh ./caption.txt์์ (์ด๋ฏธ์ง ํฌํจ)
bash scripts/post-threads.sh ./caption.txt "https://example.com/image.jpg"
ํ์ผ ๊ตฌ์กฐ
instagram-api/
โโโ SKILL.md # ์ด ํ์ผ
โโโ scripts/
โโโ post-feed.sh # ํผ๋ ํฌ์คํ
โโโ post-story.sh # ์คํ ๋ฆฌ ํฌ์คํ
โโโ post-reels.sh # ๋ฆด์ค ํฌ์คํ
โโโ post-carousel.sh # ์บ๋ฌ์
ํฌ์คํ
โโโ post-threads.sh # Threads ํฌ์คํ
์ฃผ์์ฌํญ
~/logs/sns/ ๋ก๊ทธ ํ์ธ