Instagram Trigger icon

Instagram Trigger

Triggers when Instagram events occur

Overview

The Instagram Trigger node monitors Instagram for new direct messages and emits them as soon as they are detected. It works by periodically polling the user's Instagram inbox using the Instagram Private API, making it suitable for workflows that need to react to incoming DMs—such as automated replies, notifications, or archiving messages.

Common scenarios:

  • Automatically forwarding new Instagram DMs to email or Slack.
  • Logging all received DMs into a database or spreadsheet.
  • Triggering customer support workflows when a new message arrives.

Properties

Display Name Type Description
Event options The event to trigger on. Currently supports "New Direct Message".
Polling Interval number How often (in seconds) to poll Instagram for new messages.

Details

  • Event:
    • Options:
      • New Direct Message: Triggers when a new direct message is received.
  • Polling Interval:
    • Default: 60 seconds
    • Determines how frequently the node checks for new messages.

Output

Each emitted item contains the following fields in its json property:

{
  "threadId": "string",          // The ID of the DM thread
  "messageId": "string",         // The unique ID of the message
  "message": "string",           // The text content of the message
  "senderId": "string",          // The user ID of the sender
  "timestamp": "number",         // When the message was sent (epoch time)
  "threadTitle": "string",       // Title of the DM thread
  "sessionData": { ... },        // Serialized session data for Instagram authentication
  "sessionFilePath": "string"    // Path to the local file storing session data
}
  • Note: This node does not output binary data.

Dependencies

  • External Services:
  • Credentials:
    • Needs an n8n credential named instagramPrivateApi with at least username and password.
  • Local Storage:
    • Stores session data in the user's home directory under .n8n/instagram-sessions/.

Troubleshooting

Common Issues:

  • Authentication Failures:

    • If credentials are incorrect or two-factor authentication is required, the node will fail to authenticate.
    • Error: "Failed to authenticate with Instagram. Please check your credentials."
      • Resolution: Double-check your username and password in the n8n credentials.
  • Session File Errors:

    • If the session file cannot be read or written, you may see errors like:
      • "Failed to load session from file:"
      • "Failed to save session to file:"
      • Resolution: Ensure the .n8n/instagram-sessions/ directory is writable by the n8n process.
  • API Changes or Rate Limits:

    • Since this uses an unofficial API, Instagram changes may break functionality or cause rate limits.
  • Polling Overlap:

    • If polling takes longer than the interval, the node skips overlapping polls to avoid concurrency issues.

Links and References

Discussion