Hey everyone!
Managing Meta Graph API tokens for long-running Instagram automation is often a hassle due to 60-day token expirations that quietly break production pipelines.
To solve this, I built a complete n8n workflow that handles Meta token auto-renewal, Instagram analytics extraction, and AI-driven DM lead qualification.
What is Inside:
Automatic Meta Token Refresh: Automatically pings Meta access token refresh endpoint before expiration and updates stored credentials.
AI DM Lead Qualification: Intercepts incoming DMs via Graph API webhooks, processes user intent using OpenRouter models, extracts structured lead data, and logs it to Data Tables.
Performance Analytics: Periodically pulls key Instagram account reach and engagement metrics.
Error Handling: Built-in failure branches send instant alert webhooks if an API request times out.
Open-Source Workflow and JSON: You can check out the full open-source JSON workflow, schemas, and setup instructions on GitHub:
Feel free to test it on your self-hosted or n8n cloud instance! Let me know if you have any feedback or questions regarding the setup.