Use Permanent Tokens
Never use temporary tokens in production. Generate a permanent token from a System User.
Send document signing requests and notifications directly to your signers via WhatsApp. This integration uses the official WhatsApp Business API from Meta (Graph API v22.0).
| Feature | Description |
|---|---|
| Signing Requests | Send signature links directly via WhatsApp |
| Reminders | Automated reminders for pending signatures |
| Completion Notifications | Notify signers when document is complete |
| Template Messages | Pre-approved Meta templates for compliance |
| Encrypted Credentials | AES-256-GCM encryption for API tokens |
| Country Selector | 80+ countries with flag emojis |
Before you begin, you’ll need:
Go to developers.facebook.com
Click “Get Started” or “Log In” with your Facebook account
Accept the Meta Platform Terms and Developer Policies
Verify your account (phone or email verification may be required)
You now have a Meta Developer Account
In developers.facebook.com/apps, click “Create App”
Select use case: Choose “Other” and click “Next”
Select app type: Choose “Business” and click “Next”
Enter app details:
Click “Create App” and complete any security verification
In your App Dashboard, scroll down to “Add products to your app”
Find “WhatsApp” and click “Set up”
If prompted, select or create a Meta Business Account
You’ll be redirected to the WhatsApp API Setup page
Meta provides a test phone number you can use for development
Go to business.facebook.com
If you don’t have an account, click “Create Account”
Enter your business details:
Go to Business Settings → WhatsApp Accounts
Verify your app is connected
In WhatsApp → “API Setup”
Under “From”, you’ll see a phone number with a test number provided by Meta
Copy the Phone number ID (a long numeric string like 123456789012345)
For production, click “Add phone number” to use your own business number
There are two types of tokens:
Valid for 24 hours:
Never expires - Recommended:
Go to App Settings → “Basic”
Note your App ID and App Secret
Click “Add” to create a System User:
Click “Add Assets” and assign your WhatsApp Business Account with full control
Click “Generate New Token”:
whatsapp_business_managementwhatsapp_business_messagingCopy and securely store this token
Meta requires pre-approved templates for business-initiated messages.
Create these three templates in WhatsApp Manager:
Template Name: signing_request
Category: Utility
Language: English (en)
Header: Text - “Document Ready for Signature 📝”
Body:
Hello {{1}},
You have a new document "{{2}}" ready for your signature.
Click here to sign: {{3}}
This link expires in {{4}} hours.
Thank you for using WPsigner.Variables:
{{1}} - Signer name{{2}} - Document title{{3}} - Signing URL{{4}} - Expiration hoursFooter: “WPsigner - Secure Electronic Signatures”
Template Name: signing_reminder
Category: Utility
Language: English (en)
Header: Text - “Reminder: Signature Pending ⏰”
Body:
Hello,
This is a friendly reminder that the document "{{1}}" is still awaiting your signature.
Please sign by {{2}} to avoid delays.
Sign now: {{3}}
Thank you!Variables:
{{1}} - Document title{{2}} - Due date{{3}} - Signing URLTemplate Name: signing_completed
Category: Utility
Language: English (en)
Header: Text - “Document Signed Successfully ✅”
Body:
Great news!
The document "{{1}}" was successfully signed on {{2}}.
You will receive a copy via email shortly.
Thank you for choosing {{3}}.Variables:
{{1}} - Document title{{2}} - Completion date{{3}} - Brand nameIn WordPress admin, go to WPsigner → Integrations
Find WhatsApp Business and click “Configure”
Enter your credentials:
Click “Test Connection” to verify your credentials are correct
Enable the “WhatsApp Notifications” toggle
Click “Save Settings”
When creating a document:
Go to WPsigner → New Document
In Step 2 (Add Signers), you’ll see a new WhatsApp field
Select the country code using the dropdown (with flags 🇺🇸 🇬🇧 🇲🇽)
Enter the phone number (digits only)
The full E.164 number is automatically formatted (e.g., +15551234567)
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐│ Create Document │────▶│ Signer Added │────▶│ WhatsApp Sent ││ with Phone # │ │ (wps_signer_ │ │ with Sign Link ││ │ │ created hook) │ │ │└─────────────────┘ └─────────────────┘ └─────────────────┘ │ ▼┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐│ Completion │◀────│ Document │◀────│ Signer Signs ││ WhatsApp Sent │ │ Completed │ │ Document │└─────────────────┘ └─────────────────┘ └─────────────────┘| Event | Hook | WhatsApp Action |
|---|---|---|
| Signer added with phone | wps_signer_created | Signing request with link sent |
| Signer completes signing | wps_after_document_signed | Confirmation notification sent |
| All signers done | wps_document_completed | Final notification sent to remaining signers (skips those already notified) |
| Manual reminder | Triggered from admin | Reminder template sent with updated link |
WPsigner implements enterprise-grade security for WhatsApp integration:
| Feature | Implementation |
|---|---|
| Token Encryption | AES-256-GCM encryption at rest via WPS_Encryption |
| Rate Limiting | 5 test connection attempts/min, 10 saves/min per user |
| Input Validation | Numeric-only IDs, E.164 phone format validation before sending |
| Phone Validation | Numbers validated with validate_phone() before API calls |
| Audit Logging | All settings changes logged with user attribution |
| Nonce Verification | CSRF protection on all AJAX requests |
| Capability Checks | Only manage_options users can configure |
Error: “Connection failed” when testing
Solutions:
Error: Messages not received
Solutions:
Error: Template not found
Solutions:
signing_request, signing_reminder, signing_completeden)Error: “Test Connection” or “Save Settings” buttons have no effect
Solutions:
Meta WhatsApp API has these limits:
| Tier | Messages/day | Requirements |
|---|---|---|
| Unverified | 250 | None |
| Verified Tier 1 | 1,000 | Business verification |
| Verified Tier 2 | 10,000 | Good quality rating |
| Verified Tier 3 | 100,000 | Excellent quality rating |
| Method | Description | Return |
|---|---|---|
WPS_WhatsApp::is_enabled() | Check if integration is enabled | bool |
WPS_WhatsApp::is_configured() | Check if credentials are set | bool |
WPS_WhatsApp::validate_phone($phone) | Validate E.164 phone number | bool |
WPS_WhatsApp::send_template_message($phone, $template, $params) | Send a template message | array|WP_Error |
WPS_WhatsApp::send_reminder($signer_id) | Send reminder to a signer | bool|WP_Error |
WPS_WhatsApp::send_completion($signer_id) | Send completion notification | bool|WP_Error |
WPS_WhatsApp::test_connection($phone_id, $token) | Test API connection | array|WP_Error |
// Send a signing request via WhatsApp$result = WPS_WhatsApp::send_template_message( '+15551234567', // Phone in E.164 format 'signing_request', // Template name [ 'John Doe', // {{1}} Signer name 'NDA Contract', // {{2}} Document title 'https://...', // {{3}} Signing URL '48', // {{4}} Hours to expire ]);
if ( is_wp_error( $result ) ) { error_log( 'WhatsApp send failed: ' . $result->get_error_message() );}// Check if WhatsApp is enabled and configuredif ( WPS_WhatsApp::is_enabled() && WPS_WhatsApp::is_configured() ) { // WhatsApp is ready to send messages}// Validate phone before storing$phone = '+15551234567';if ( WPS_WhatsApp::validate_phone( $phone ) ) { // Valid E.164 format}// Send reminder for a specific signer$result = WPS_WhatsApp::send_reminder( $signer_id );
if ( is_wp_error( $result ) ) { // Handle error}// Test with specific credentials (useful for validation before saving)$result = WPS_WhatsApp::test_connection( '123456789012345', 'your_token' );
if ( ! is_wp_error( $result ) ) { echo 'Connected: ' . $result['verified_name'];}You can extend the WhatsApp integration using these hooks:
// Hook into the signing request flowadd_action( 'wps_signer_created', function( $signer_id, $document_id ) { // Called when a signer is added to a document // WhatsApp message is sent automatically if phone is set}, 10, 2 );
// Hook into document signed eventadd_action( 'wps_after_document_signed', function( $document_id, $signer_id ) { // Called when a signer completes signing}, 10, 2 );
// Hook into document completed (all signers done)add_action( 'wps_document_completed', function( $document_id ) { // Called when all signers have completed}, 10, 1 );Use Permanent Tokens
Never use temporary tokens in production. Generate a permanent token from a System User.
Verify Your Business
Complete Meta Business Verification for higher message limits and trust.
Monitor Quality Rating
Keep your quality rating high by avoiding spam and honoring opt-outs.
Test Before Production
Use Meta’s test phone number during development before going live.
Q: Is WhatsApp Business API free?
A: Meta offers 1,000 free conversations per month. Additional messages are charged per conversation (typically $0.01-0.05 based on region).
Q: Can I use my personal WhatsApp number?
A: No, you must use a dedicated business number registered with WhatsApp Business API.
Q: How long does template approval take?
A: Usually 24-48 hours. Some templates may be rejected if they violate Meta’s policies.
Q: What happens if WhatsApp fails?
A: Email notifications are always sent as a fallback. WhatsApp is an additional channel.
| Component | Version |
|---|---|
| Meta Graph API | v22.0 (supported until ~May 2027) |
| WPsigner integration | v2.0.0+ |
| Database | MySQL and SQLite (WP_SQLite_DB) compatible |