NAME
WebService::WAservix - WAservix WhatsApp API Gateway: official Perl client by Tekservix (send WhatsApp messages from your own number)
SYNOPSIS
use WebService::WAservix;
my $wa = WebService::WAservix->new(api_key => $ENV{WASERVIX_KEY});
my $res = $wa->send_text('+15551234567', 'Hello Aline, your order is ready');
print "Queued message $res->{msgId}\n"; # status starts as "in_progress"
$wa->send_document('+15551234567', 'https://example.com/inv-1042.pdf',
file_name => 'Invoice-1042.pdf', caption => 'Your invoice');
DESCRIPTION
WAservix links your own WhatsApp number by QR code (the same way WhatsApp Web does) and gives you a REST API to send text, images, documents, locations, polls and more, with webhooks for incoming messages.
You need a Tekservix account with WAservix and the API key of your number (Devices in the dashboard). Keep the key on your server. API reference: https://tekservix.com/waservix/docs/.
WAservix is not Meta's official WhatsApp Business Platform: WhatsApp's spam rules apply to your number directly, so message people who expect to hear from you.
Uses only core modules (HTTP::Tiny, JSON::PP); HTTPS needs IO::Socket::SSL.
METHODS
All methods return the decoded data part of the answer and die with a "WebService::WAservix::Error" object on failure.
new(api_key => $key, [base_url => $url], [timeout => 30], [http => $http_tiny])
send_message($to, %fields)
Any message type to a number or group JID (...@g.us), with the API field names. Returns { msgId => ..., jid => ..., status => 'in_progress' }.
send_text($to, $text), send_image($to, $url, [caption => $text]), send_document($to, $url, [file_name => $name], [caption => $text]), send_location($to, $lat, $lng, [name => $name])
get_message_info($id), edit_message($id, $text), delete_message($id), resend_message($id)
on_whatsapp($phone), get_status, get_user
list_contacts, get_contact($phone), save_contact($phone, $name), list_groups, get_group_metadata($jid)
list_sessions, get_session($id), create_session(\%params), connect_session($id, [phone => $phone]), get_session_qr_code($id)
Session management needs a personal access token instead of a device key.
request($method, $path, [$body])
Calls any documented endpoint.
verify_webhook($signature, $secret)
Constant-time check of the X-Webhook-Signature header against your number's webhook secret. Can be called as a function or a class method.
WebService::WAservix::Error
Has status, message, errors, body and retry_after. A 503 means the number is reconnecting: retry shortly.
SEE ALSO
WebService::SmsGora (SMS through your own Android phones), https://tekservix.com/ai-sales-agent (AI Sales Agent), https://tekservix.com/mobile-apps (Website to App).
AUTHOR
Tekservix <support@tekservix.com>
LICENSE
MIT. See the LICENSE file.