Skip to content

Usage Guide

Adding an Instagram Account

  1. Navigate to Social Media > Instagram Accounts in your Filament panel
  2. Click New Instagram Account
  3. Fill in:
    • Account Name: A friendly name for this account
    • Instagram Business Account ID: Your IG Business Account ID from Meta
    • Access Token: Your long-lived access token from Meta Developer Dashboard
    • Active: Toggle to enable/disable this account

Creating a Post

  1. Navigate to Social Media > Posts in your Filament panel
  2. Click New Post
  3. Fill in:
    • Instagram Account: Select which account to post from
    • Image: Upload an image (max 8MB, JPEG/PNG)
    • Caption: Write your caption (optional, max 2,200 characters)
    • Schedule Date & Time: Choose when to publish (leave empty for immediate draft)

Post Status Flow

  • Draft: Post created but not scheduled
  • Scheduled: Post will be published at the scheduled time
  • Publishing: Post is currently being published to Instagram
  • Published: Post successfully published to Instagram
  • Failed: Post publication failed (check error message)

Scheduled Posts Processing

Scheduled posts are automatically processed every minute by Laravel's scheduler.

To manually process scheduled posts, run:

bash
php artisan socialmedia:process-scheduled-posts

Make sure your Laravel scheduler is running:

bash
php artisan schedule:work

Or add to your crontab:

* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

Multi-Tenancy

This module fully supports multi-tenancy using the ModuleManager helpers:

  • Each tenant can have their own Instagram accounts
  • Posts are automatically scoped to the current tenant
  • Access tokens are securely encrypted per tenant

Instagram API Notes

Image Requirements

  • Format: JPEG or PNG
  • Max size: 8MB
  • Aspect ratio: Between 4:5 and 1.91:1
  • The image must be publicly accessible via HTTPS

Access Token

  • Use a long-lived access token (60 days)
  • Remember to refresh tokens before they expire
  • Store tokens securely (they are encrypted in the database)

Rate Limits

  • Instagram API has rate limits
  • Failed posts will show error messages
  • Check logs for detailed API responses

Troubleshooting

Posts Stuck in "Publishing"

Check your queue workers are running:

bash
php artisan queue:work

Failed Posts

  1. Check the error message in the post record
  2. Verify your access token is valid
  3. Ensure the image URL is publicly accessible
  4. Check Instagram API status

Logs

All Instagram API interactions are logged. Check:

bash
tail -f storage/logs/laravel.log

Development

Testing the API

You can test the Instagram API integration by creating a test post with a scheduled date in the near future, then watching the logs as it processes.

Queue Configuration

By default, posts use the default queue. To customize:

php
// In config/socialmedia.php or module-manager.php
'modules' => [
    'socialmedia' => [
        'queue' => 'instagram',
    ],
],

Security

  • Access tokens are encrypted using Laravel's Crypt facade
  • Only users with proper permissions can create/manage posts
  • Multi-tenant isolation ensures data separation