Package Information
Documentation
n8n-nodes-instagram-dm
This is an n8n community node that provides Instagram Direct Messaging functionality via the Meta Graph API.
Features
- ✅ Send Direct Messages: Send text messages to Instagram users
- ✅ List Conversations: Retrieve list of conversations for your Instagram Business Account
- ✅ Get Conversation Details: Fetch details and messages from specific conversations
- ✅ Secure Authentication: Built-in credential management with encrypted storage
- ✅ Error Handling: Comprehensive error handling and logging
Prerequisites
Before using this node, you need:
- Instagram Business Account: A verified Instagram Business Account
- Facebook App: A Facebook App with Instagram permissions
- Access Token: A valid Access Token with the following permissions:
instagram_basic
instagram_manage_messages
pages_messaging
Installation
To install this community node in n8n:
Via npm (when published)
npm install n8n-nodes-instagram-dm
Via n8n Community Nodes (when published)
- Go to Settings → Community Nodes
- Click "Install a community node"
- Enter:
n8n-nodes-instagram-dm
For Development
- Clone this repository
- Run
npm install
- Run
npm run build
- Link to your n8n installation
Setup
1. Create Instagram DM API Credentials
- In n8n, go to Credentials → New Credential
- Search for "Instagram DM API"
- Fill in:
- Access Token: Your Instagram Graph API access token
- Instagram Business Account ID: Your Instagram Business Account ID
2. Test Your Credentials
The credential includes a built-in test that verifies:
- Your access token is valid
- Your Instagram Business Account ID is accessible
Usage
Send Message
Send a direct message to an Instagram user:
Required Parameters:
- Recipient ID: Instagram User ID of the message recipient
- Message Text: The text content of your message
Optional Parameters:
- Messaging Product: Set to "instagram" (default)
List Conversations
Retrieve conversations for your Instagram account:
Optional Parameters:
- Limit: Number of conversations to return (default: 25, max: 50)
- Fields: Comma-separated list of fields to include (default: "id,participants,updated_time")
Get Conversation
Get details of a specific conversation:
Required Parameters:
- Conversation ID: ID of the conversation to retrieve
Optional Parameters:
- Fields: Comma-separated list of fields to include (default: "id,participants,messages,updated_time")
Example Workflows
Basic Message Sending
Trigger → Instagram DM (Send Message)
Customer Service Bot
Webhook → Code Node (Process) → Instagram DM (Send Message)
Conversation Monitor
Schedule → Instagram DM (List Conversations) → Filter → Instagram DM (Get Conversation)
API Reference
This node uses the Meta Graph API v19.0. For detailed API documentation, visit:
Troubleshooting
Common Issues
"Invalid Access Token"
- Verify your token hasn't expired
- Ensure proper permissions are granted
- Check if your Facebook App is approved for production
"Recipient ID not found"
- Verify the Instagram User ID is correct
- Ensure the user has previously interacted with your business account
"Rate limit exceeded"
- Instagram has rate limits on messaging
- Implement delays between messages
- Monitor your API usage
Getting Help
- Check the Instagram API documentation
- Review the n8n community forum
- File issues in this repository
Development
Building the Node
npm run build
Linting
npm run lint
npm run lintfix
Testing
npm test
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Run linting and ensure builds pass
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Support
If you find this node helpful, please consider:
- ⭐ Starring this repository
- 📢 Sharing it with others
- 🐛 Reporting bugs and issues
- 💡 Suggesting new features
Note: This is a community-maintained node and is not officially supported by n8n or Meta/Facebook. Use at your own discretion and ensure compliance with Instagram's Terms of Service and API policies.