Actions2
- Direct Messages Actions
Overview
This node enables sending direct media messages via the Instagram Business API. Specifically, it supports sending images, videos, or audio files as direct messages to Instagram users identified by their Instagram User ID (IGID). This functionality is useful for businesses or social media managers who want to automate personalized multimedia communication with their audience on Instagram.
Common scenarios include:
- Sending promotional images or videos directly to customers.
- Sharing audio messages or announcements privately.
- Automating customer support responses with rich media content.
For example, a marketing automation workflow could send a welcome video message to new followers or customers after they sign up.
Properties
| Name | Meaning |
|---|---|
| Instagram User ID | The recipient's Instagram User ID (IGID), used to identify the user to whom the message is sent. |
| Media URL | The URL of the media file to send. Can be an image, video, or audio file accessible via HTTP(S). |
| Media Type | The type of media being sent. Options are: Image, Video, Audio. |
Output
The node outputs a JSON object containing details about the sent media message:
success: Boolean indicating if the operation was successful.operation: The operation performed, here always"sendMediaMessage".userId: The Instagram User ID of the message recipient.mediaUrl: The URL of the media that was sent.mediaType: The type of media sent (image, video, or audio).attachmentId: The identifier of the uploaded media attachment returned by the Instagram API.messageId: The ID of the sent message.sentAt: Timestamp when the message was sent.apiResponse: (Not included in this operation output but present in other operations) Raw response from the Instagram API.
If an error occurs, the output JSON will contain:
error: Error message describing what went wrong.operation: The attempted operation.resource: The resource involved ("messages").success: falsetimestamp: When the error occurred.
Dependencies
- Requires an active Instagram Business account connected via the Meta API.
- Needs an API authentication token (access token) with permissions to send Instagram direct messages.
- The node makes HTTP POST requests to the Facebook Graph API endpoints (
/me/message_attachmentsand/me/messages) to upload media and send messages. - Proper configuration of credentials in n8n is necessary to authenticate API calls.
Troubleshooting
- Invalid Instagram User ID: If the provided user ID is incorrect or not reachable, the API will return an error. Verify the IGID is correct and corresponds to a valid Instagram user.
- Media URL inaccessible: The media URL must be publicly accessible. Private URLs or URLs requiring authentication will cause failures.
- Unsupported media type: Only "image", "video", and "audio" types are supported. Using other types will result in errors.
- API permission errors: Ensure the access token has the required scopes to send messages and upload attachments.
- Rate limits: The Instagram API enforces rate limits; excessive requests may lead to temporary blocking.
- Error messages: The node surfaces API error messages prefixed with "API Error:" or "Request failed:". These should be reviewed to understand specific issues like invalid parameters or permission problems.