Generate WhatsApp URL is a WordPress ability from Joinchat — usable via Easy MCP AI, which connects Claude, ChatGPT, and any AI assistant to your site.
Install Free Plugin →Generate WhatsApp URL
Read-onlyBuild a WhatsApp click-to-chat URL from a phone number and optional pre-filled message.
Requires the Joinchat plugin installed on WordPress 6.9+ with the Abilities API available (abilities register on the wp_abilities_api_init hook). The get-phone, set-phone, set-cta, and set-message abilities require the 'edit_posts' capability when a post_id or term_id context is supplied, or the capability returned by Joinchat_Util::capability() (defaults to 'manage_options', filterable via the 'joinchat_capability' filter) for global changes. The get-whatsapp-url ability has no permission check.
What it does
This ability generates a wa.me WhatsApp 'click to chat' URL by cleaning the supplied phone number and, if a message is given, appending it as a URL-encoded pre-filled text parameter. It takes a required phone input (with country code) and an optional message string, and returns the assembled URL as a string, or an empty string if the phone is blank after cleaning. Because the ability has no permission check (permission_callback is __return_true) and only formats data rather than touching site settings, an AI assistant can call it freely to produce a ready-to-share WhatsApp link for a given number and message. This is useful for drafting outbound contact links in emails, landing pages, or chat replies without hand-crafting the wa.me URL syntax.
See it in action
You ask your AI assistant
"Generate a WhatsApp click-to-chat URL for +1 555 123 4567 with the pre-filled message 'Hi, I'd like a quote for your services.'"
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| phone | string | Yes | WhatsApp phone number (with country code). |
| message | string | No | Optional pre-filled message text. Defaults to empty. |
Returns
A string containing the wa.me click-to-chat URL (with the phone number and, if provided, a URL-encoded pre-filled message), or an empty string if no valid phone is supplied.
Permission
No permission required — the permission_callback is __return_true, so any caller can generate a URL.
More Joinchat abilities
Get WhatsApp contact Phone
Read the WhatsApp phone number configured for the site, or for a specific post or term.
Set Call to Action
Update the call-to-action text shown with the Joinchat chat button, globally or per post/term.
Set WhatsApp contact Phone
Update the WhatsApp phone number globally or for a specific post/term.
Set WhatsApp pre-filled Message
Update the pre-filled WhatsApp message sent when a visitor starts a chat, globally or per post/term.