AI Instagram Auto Poster
/install instagram-auto-posting
\r \r
Instagram Posting Pipeline\r
\r End-to-end Instagram automation pipeline. Generate professional promotional images and publish them automatically to any Instagram Business account — no third-party automation tools needed.\r \r
Skill Scope\r
\r
- Generate promotional images (text + branding overlays, 1080×1350)\r
- Upload images to Cloudinary for public hosting\r
- Publish to Instagram via Meta Graph API\r
- Optional: extract business info from a public website URL\r \r Not in scope: scraping private/internal networks, storing credentials externally, third-party data sharing.\r \r
Install Model\r
\r
Instruction-driven skill — all scripts are bundled in the package. No external binaries, installers, or runtime dependencies beyond Python 3.8+ and Pillow. Place the scripts/ folder alongside the skill and configure env vars to use.\r
\r
Pipeline Flow\r
\r
Business info (name, details, website URL)\r
→ scrape_business.py (optional — auto-extract from website)\r
→ generate_course_promo.py\r
→ upload_cloudinary.py\r
→ post_to_instagram.py\r
→ Instagram post URL\r
```\r
\r
## Data Extraction (Optional)\r
\r
`scrape_business.py` fetches a **user-provided public URL** to extract business info — name, tagline, services, contact — for auto-generating content.\r
\r
**What it does:**\r
- Makes an outbound HTTP(S) request to the provided URL\r
- Parses the HTML response using Python's built-in `html.parser`\r
- Extracts title, meta description, H1 tags, paragraphs, and contact patterns\r
- Returns structured data to populate the image generation prompt\r
- May extract email and phone if publicly available\r
\r
**What it does NOT do:**\r
- Does not follow redirects to third-party domains (all 3xx responses are blocked)\r
- Does not access internal/private networks\r
- Does not store or retransmit scraped data\r
\r
> Do not provide internal/private URLs (e.g. `localhost`, `192.168.x.x`, `10.x.x.x`). SSRF protections enforced: DNS resolution + private-IP blocking (via `ipaddress` module), SSL certificate verification, scheme/hostname allowlist, and **all redirects are explicitly blocked** (no following 3xx responses to any destination).\r
\r
## Environment Setup\r
\r
Before using, set these environment variables:\r
\r
```bash\r
# Meta Graph API (required)\r
export IG_ACCESS_TOKEN="your_page_access_token"\r
export IG_BUSINESS_ACCOUNT_ID="your_ig_business_account_id"\r
export IG_DEFAULT_CAPTION="Your default caption"\r
\r
# Cloudinary (required — create your own free account)\r
# No default credentials are used — you must set up your own\r
export CLOUDINARY_CLOUD_NAME="your_cloud_name"\r
export CLOUDINARY_UPLOAD_PRESET="your_unsigned_preset"\r
export CLOUDINARY_FOLDER="mybusiness"\r
\r
# Image output (optional)\r
export IG_PIPELINE_OUTPUT_DIR="./output"\r
```\r
\r
## Security & Credentials\r
\r
**Your credentials stay yours.**\r
\r
- Tokens are **user-provided at runtime** (environment variables)\r
- Tokens are **never stored externally** or sent to any third-party service\r
- Tokens are **used only during execution** and never persisted\r
- SSL/TLS verification is enforced on all outbound requests\r
- Use least-privilege and test accounts during evaluation\r
- Never log tokens — only non-sensitive metadata is logged\r
\r
**Cloudinary hardening recommendation:**\r
Prefer signed upload presets, or restrict unsigned presets by folder/origin in your Cloudinary dashboard.\r
\r
### Getting Credentials\r
\r
**Access Token:**\r
1. Go to https://developers.facebook.com/tools/explorer/\r
2. Select your Facebook App (must have `instagram_content_publish` and `pages_read_engagement` permissions)\r
3. Generate token for your Page\r
4. Grant `pages_read_engagement`, `instagram_content_publish`\r
\r
**IG Business Account ID:**\r
- Found in Meta Business Suite → Instagram settings → Account ID\r
\r
## Step-by-Step Usage\r
\r
### Step 1: Generate Image\r
\r
```python\r
from generate_course_promo import generate_course_promo\r
\r
path = generate_course_promo(\r
course_name="Diploma in Artificial Intelligence",\r
institution="CADDESK Centre",\r
duration="90 Weeks",\r
bullets=[\r
"Machine Learning & Data Science",\r
"Building Intelligent Systems",\r
"Algorithm Development",\r
"Real-World AI Projects",\r
],\r
hook_lines=["Your Future in AI", "Starts Here."],\r
cta_text="Ready to shape the future with AI?",\r
handle="@caddeskcentre",\r
output_filename="course_promo.png"\r
)\r
```\r
\r
CLI:\r
```bash\r
python scripts/generate_course_promo.py\r
```\r
\r
### Step 2: Upload to Cloudinary\r
\r
```bash\r
python scripts/upload_cloudinary.py \x3Cimage_path> [folder]\r
```\r
\r
Returns a public URL like `https://res.cloudinary.com/image/upload/xyz.png`\r
\r
### Step 3: Post to Instagram\r
\r
```bash\r
python scripts/post_to_instagram.py \x3Cimage_url> \x3Ccaption>\r
```\r
\r
Or programmatically:\r
\r
```python\r
from post_to_instagram import post_to_instagram\r
\r
success, post_id, ig_url = post_to_instagram(\r
image_url="https://res.cloudinary.com/image/upload/xyz.png",\r
caption="Your caption with #hashtags"\r
)\r
```\r
\r
## Caption Structure\r
\r
```\r
[HOOK - bold claim or question, 1-2 lines]\r
[VALUE - what they'll learn/achieve]\r
[CTA - link in bio / DM to enroll / visit website]\r
[8-15 hashtags - mix of broad + niche]\r
```\r
\r
## Troubleshooting\r
\r
| Error | Fix |\r
|-------|-----|\r
| `401 Invalid OAuth` | Token expired — regenerate at Graph API Explorer |\r
| `IG token format error` | Use Page Access Token, not IG-only token |\r
| `image_url required` | Image not publicly accessible — upload to Cloudinary first |\r
| `403 Forbidden` | App not in Live mode or `instagram_content_publish` permission not approved |\r
| `Cloudinary 400` | Image too large (>10MB), unsupported format, or credentials not configured |\r
| `IG account not found` | Account not set as Business/Creator mode in Meta |\r
| Scrape returns None | Website uses JS rendering — provide details manually |\r
\r
## Multiple Accounts\r
\r
To switch between IG accounts, update environment variables before each post:\r
\r
```bash\r
export IG_ACCESS_TOKEN="token_for_account_a"\r
export IG_BUSINESS_ACCOUNT_ID="ig_id_account_a"\r
python scripts/post_to_instagram.py \x3Curl> \x3Ccaption>\r
```\r
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install instagram-auto-posting - 安装完成后,直接呼叫该 Skill 的名称或使用
/instagram-auto-posting触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
AI Instagram Auto Poster 是什么?
Automate creation and direct posting of promotional images to Instagram Business accounts using Meta Graph API without third-party schedulers or paid tools. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 149 次。
如何安装 AI Instagram Auto Poster?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install instagram-auto-posting」即可一键安装,无需额外配置。
AI Instagram Auto Poster 是免费的吗?
是的,AI Instagram Auto Poster 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
AI Instagram Auto Poster 支持哪些平台?
AI Instagram Auto Poster 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 AI Instagram Auto Poster?
由 Pawan Shekhawat(@pawanshekhawat)开发并维护,当前版本 v1.0.7。