Bot for Auto-Publishing Products from Website to Instagram
Manually publishing each product in Instagram consumes hours of a content manager's time. Mistakes in hashtags, duplication, delays are common. We create a bot that handles this routine. It automatically takes products from the site's catalog and publishes them to Instagram – with photos, descriptions, prices, hashtags. Without manual work, without data duplication, without delays. Our experience in developing integrations with Meta API is over 10 projects. Contact us for a consultation on your project.
Why Is Automating Product Publication in Instagram Beneficial?
Each post requires time: image preparation, writing a description, selecting hashtags, checking for duplicates. The bot reduces the time per post from 10 minutes to 30 seconds – that's 20 times faster. With 50 products per month, the saving is 8 hours of work. Mistakes in hashtags or delays with new arrivals become a thing of the past. Posts go out strictly on schedule, without weekends.
How It Works Technically
Instagram does not provide a direct public API for posting from personal accounts. The official path is Instagram Graph API through Meta Business Suite. It allows publishing photos, carousels, and Reels for business and creator accounts.
Integration schema:
- Site (CMS/store) → task queue (Redis + BullMQ or Laravel Queue)
- Worker fetches task → prepares media and text
- Request to Graph API: upload image → create container → publish
POST https://graph.facebook.com/v19.0/{ig-user-id}/media ?image_url=https://cdn.example.com/products/123.jpg &caption=New%20arrival%3A%20Air%20Max%20sneakers%0A%0A%23sneakers%20%23shoes &access_token={PAGE_ACCESS_TOKEN} POST https://graph.facebook.com/v19.0/{ig-user-id}/media_publish ?creation_id={container-id} &access_token={PAGE_ACCESS_TOKEN} For publishing a carousel (multiple product photos), first create child containers for each image, then a parent container of type CAROUSEL.
What Is Needed from the Client
- Instagram Business or Creator account
- Linked Facebook Page
- Meta App with permissions:
instagram_basic,instagram_content_publish,pages_read_engagement - Long-lived access token (valid for 60 days, auto-refresh required)
Token auto-refresh is implemented via a scheduled job – 7 days before expiration, the token is exchanged for a new one through /oauth/access_token?grant_type=fb_exchange_token. More details on token handling can be found in Meta's documentation.
How to Avoid Exceeding Graph API Limits?
The main limits: 25 publications per day per account and 200 API calls per hour per user. The bot uses a task queue with delays, retries, and response caching. Before each request, it checks the number of publications in the last 24 hours. When the limit is exhausted, the task is postponed to the next day. This guarantees uninterrupted operation without blocks.
Generating the Post Caption
The caption template is assembled from product fields:
def build_caption(product): lines = [ f"✨ {product['name']}", "", product['short_description'][:200] if product['short_description'] else "", ] lines += ["", " ".join(f"#{tag}" for tag in product['tags'][:10])] return "\n".join(line for line in lines if line is not None) Caption length is up to 2200 characters, hashtags up to 30. Exceeding the limit is handled by truncating the description, not the hashtags.
Publication Triggers
| Trigger | Mechanism |
|---|---|
| New product with status "published" | Webhook / Observer on Product model |
| Price change by X% | price_changed_at field + cron comparison |
| Scheduled posting | instagram_scheduled_at field on product |
| Manual launch from admin panel | Button → API endpoint → queue task |
Comparison of Manual and Automatic Publication
| Parameter | Manual Publication | Automatic Publication |
|---|---|---|
| Time per post | 10–15 min | 0 min (bot) |
| Duplication risk | High | Zero (deduplication) |
| Error rate | 5–10% of posts | Less than 1% (API errors) |
| Carousel capability | Requires manual compilation | Automatically assembled |
Deduplication and Limits
Graph API allows up to 25 publications per day per account (carousel counts as 1). The bot maintains an instagram_posts table with fields product_id, ig_media_id, published_at. Before posting, it checks:
- whether the product was published in the last N days
- whether the daily limit has been exceeded
- whether the image is accessible via URL (HEAD request with 5s timeout)
What Is Included in the Work
- Analysis of your site and product catalog
- Setting up Meta Business Suite and obtaining tokens
- Developing a worker for the task queue (Laravel Queue / BullMQ)
- Integration with Graph API: media upload, container creation, publishing
- Generating captions and hashtags based on product fields
- Implementing deduplication and limit handling
- Admin panel on the site (manual launch, error log)
- Documentation, access, manager training
- 30-day warranty support after launch
Implementation Timelines
Basic bot with single photo publication – 5–7 business days. Carousel, caption template engine, admin panel, retries on API errors – another 3–5 days. Get a free consultation for your project – we'll estimate timelines and cost.
Contact us to discuss the integration.







