NAME

WebService::SmsGora - SMS Gora SMS Gateway: official Perl client by Tekservix (send and receive SMS through your own Android phones)

SYNOPSIS

use WebService::SmsGora;

my $sms = WebService::SmsGora->new(api_key => $ENV{SMSGORA_KEY});

my $result = $sms->send_sms(to => '+15551234567', message => 'Your code is 482913');
print "Queued: @{ $result->{message_ids} }\n";

my $msg = $sms->get_message($result->{message_ids}[0]);
print "Status: $msg->{status}\n";   # queued, dispatched, sent, delivered, failed

DESCRIPTION

SMS Gora turns Android phones with ordinary SIM cards into an SMS gateway. Your server calls the API, a linked phone sends the text, and replies and delivery reports come back to you by webhook.

You need a Tekservix account with SMS Gora and an API key (SMS Gora -> API keys). Keep the key on your server. API reference: https://tekservix.com/smsgora/docs/.

Uses only core modules (HTTP::Tiny, JSON::PP, Digest::SHA); HTTPS needs IO::Socket::SSL.

METHODS

All methods return the decoded data part of the answer and die with a "WebService::SmsGora::Error" object on failure.

new(api_key => $key, [base_url => $url], [timeout => 30], [http => $http_tiny])

send_sms(to => $number_or_arrayref, message => $text, [device_id => $id], [sim_slot => 0|1], [schedule_at => $iso8601])

Sends to up to 1,000 numbers. to may be an array reference or a comma separated string. Returns { message_ids => [...] }.

send_bulk_sms($device_id, messages => [ { recipients => [...], message => $text }, ... ], [message_template => $text])

Different texts for different people in one call (up to 5,000 recipients).

get_message($id), cancel_message($id)

list_messages(%filters), list_received_sms([device_id => $id], %filters)

Filters: direction, status, phone, since, after_id, page, limit.

get_batch($id), list_devices, get_device($id), get_account

list_webhooks, create_webhook(url => $url, [events => [...]], [device_id => $id]), delete_webhook($id)

request($method, $path, [$body])

Calls any documented endpoint.

verify_webhook($raw_body, $signature, $secret)

Checks the X-SmsGora-Signature header of an incoming webhook in constant time. Can be called as a function or a class method. Pass the raw request body.

WebService::SmsGora::Error

Has status, message, errors, body and retry_after (seconds, on 429). Stringifies to a readable message.

SEE ALSO

WebService::WAservix (WhatsApp from your own number), 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.