Skip to main content

Send Document Message

Sends a document file via the WhatsApp Business Cloud API. Documents can be sent using a public URL or a Media ID from uploaded media.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • Phone Number ID - WhatsApp Business Phone Number ID from Meta Developer Portal.
  • To Phone Number - Recipient's phone number with country code (without + sign). Example: 1234567890.
  • Document URL - Public HTTPS URL of the document or Media ID from uploaded media.

Options

  • API Version - Meta Graph API version. Default is 21.0.
  • Caption - Optional document caption/description.
  • Filename - Display filename for the document (shown to recipient).
  • Use Media ID - Set to true to use Media ID instead of URL. Default is false.
  • Access Token - WhatsApp Cloud API Access Token credential (required).

Output

  • Response - The complete API response object containing message details and status.

How It Works

The Send Document Message node sends a document file to a WhatsApp user. When executed, the node:

  1. Validates all required inputs
  2. Retrieves the access token from the credential
  3. Constructs the message payload with either URL or Media ID
  4. Adds optional caption and filename if provided
  5. Sends a POST request to the WhatsApp API
  6. Returns the API response with message details

Requirements

  • A WhatsApp Business Account in Meta Developer Portal
  • Access Token with appropriate permissions
  • For URLs: Document must be publicly accessible via HTTPS
  • For Media IDs: Media must be uploaded using Upload Media node
  • Document must be in supported format and size

Supported Document Formats

  • PDF (.pdf)
  • Microsoft Word (.doc, .docx)
  • Microsoft Excel (.xls, .xlsx)
  • Microsoft PowerPoint (.ppt, .pptx)
  • Text (.txt)
  • OpenDocument (.odt, .ods, .odp)
  • Rich Text Format (.rtf)

Maximum file size: 100 MB

Error Handling

The node will return specific errors in the following cases:

  • Empty or invalid Phone Number ID
  • Empty or invalid recipient phone number
  • Empty or invalid Document URL
  • Document URL not accessible
  • Document URL not HTTPS
  • Document exceeds size limit (100 MB)
  • Unsupported document format
  • Invalid Media ID
  • Invalid access token
  • Network connectivity issues

Example: Send PDF Invoice

Inputs:

  • Phone Number ID: 123456789012345
  • To Phone Number: 14155551234
  • Document URL: https://example.com/invoices/INV-2024-001.pdf

Options:

  • Caption: Your invoice for March 2024
  • Filename: Invoice-March-2024.pdf
  • Use Media ID: false

Example: Send Document with Media ID

Flow:

  1. Upload Media node outputs Media ID: 1122334455
  2. Send Document Message node:

Inputs:

  • Phone Number ID: 123456789012345
  • To Phone Number: 14155551234
  • Document URL: 1122334455 (the Media ID)

Options:

  • Caption: Contract document for review
  • Filename: Contract-Agreement.pdf
  • Use Media ID: true

Example: Send Report

Use Case: Send automated reports to managers

Inputs:

  • Phone Number ID: 123456789012345
  • To Phone Number: {{manager.phone}}
  • Document URL: {{report.fileUrl}}

Options:

  • Caption: {{report.type}} Report - {{report.date}}\n\nGenerated automatically by RPA system
  • Filename: {{report.type}}-{{report.date}}.pdf

Usage Notes

  • Always specify a meaningful filename for better user experience
  • Captions help provide context about the document
  • PDF is the most widely compatible format
  • Large documents may take time to upload and download
  • Media IDs expire after 30 days
  • Documents are downloaded to the recipient's device when opened
  • File extension in filename helps users identify the file type

Tips for RPA Developers

  • Generate PDFs programmatically for invoices, reports, contracts
  • Use consistent filename naming conventions
  • Include metadata in captions (date, reference numbers, etc.)
  • Validate document exists and is accessible before sending
  • Compress large documents to reduce file size
  • Use Upload Media node for local files
  • Store documents in cloud storage with permanent URLs
  • Track document delivery and download status
  • Implement retry logic for failed document sends
  • Log document sends for audit purposes

Common Use Cases

Invoice Delivery:

{
"caption": "Invoice #INV-2024-12345\nAmount: $1,234.56\nDue Date: March 31, 2024",
"filename": "Invoice-INV-2024-12345.pdf"
}

Contract Signing:

{
"caption": "Please review and sign the attached contract. Reply with 'ACCEPTED' to confirm.",
"filename": "Service-Agreement-2024.pdf"
}

Report Distribution:

{
"caption": "Monthly Sales Report - February 2024\nTotal Sales: $50,000\nTop Product: Widget Pro",
"filename": "Sales-Report-Feb-2024.xlsx"
}

Documentation Delivery:

{
"caption": "User Manual for Product XYZ\nVersion 2.0 - Updated March 2024",
"filename": "Product-XYZ-Manual-v2.0.pdf"
}

Common Errors and Solutions

Error: URL not accessible

  • Verify URL is publicly accessible
  • Ensure URL uses HTTPS
  • Check authentication requirements
  • Test URL in a browser

Error: Document too large

  • Compress the document
  • Split large documents into smaller parts
  • Maximum size is 100 MB
  • Use file compression tools

Error: Unsupported format

  • Convert to PDF for maximum compatibility
  • Check file extension matches content
  • Avoid password-protected documents
  • Use standard office formats

Error: Invalid filename

  • Include file extension in filename
  • Avoid special characters
  • Keep filename descriptive but concise

Best Practices

  • Always include a descriptive filename
  • Use PDF for universal compatibility
  • Add captions to explain document content
  • Keep documents under 10 MB for faster delivery
  • Test document opening on mobile devices
  • Include reference numbers in captions
  • Follow naming conventions for easy identification
  • Don't send sensitive data without encryption
  • Comply with data protection regulations
  • Follow WhatsApp Business Policy for content
  • Track document delivery status
  • Implement confirmation workflow if needed

Security Considerations

  • Don't send personally identifiable information (PII) unless necessary
  • Use password protection for sensitive documents when possible
  • Ensure URLs expire after a reasonable time
  • Log all document transmissions for audit
  • Comply with GDPR, CCPA, and other regulations
  • Verify recipient identity before sending sensitive documents
  • Use secure cloud storage with access controls