Package 'smsgora'

Title: Client for the 'SMS Gora' SMS Gateway
Description: Client for the 'SMS Gora' SMS Gateway <https://tekservix.com/smsgora/>, which sends and receives text messages (SMS, Short Message Service) through your own 'Android' phones and SIM cards. Send single, scheduled and bulk messages, check delivery status, read received messages, manage linked phones and event notifications, and verify their signatures. A 'Tekservix' account with 'SMS Gora' and an API key are required.
Authors: Joseph Niyogushimwa [aut, cre], Tekservix [cph, fnd]
Maintainer: Joseph Niyogushimwa <[email protected]>
License: MIT + file LICENSE
Version: 1.0.1
Built: 2026-12-04 20:13:49 UTC
Source: https://github.com/cran/smsgora

Help Index


Cancel a queued or scheduled message

Description

Cancel a queued or scheduled message

Usage

smsgora_cancel_message(client, message_id)

Arguments

client

A client from smsgora_client().

message_id

Message ID.

Value

The cancelled message.

Examples

## Not run: 
smsgora_cancel_message(smsgora_client("sgk_your_key"), 1873)

## End(Not run)

Create an SMS Gora client

Description

Create an SMS Gora client

Usage

smsgora_client(
  key = Sys.getenv("SMSGORA_API_KEY"),
  base_url = "https://tekservix.com/smsgora/api/v1"
)

Arguments

key

Your SMS Gora API key (starts with sgk_). Defaults to the SMSGORA_API_KEY environment variable.

base_url

API base URL. Change it only for tests or a proxy.

Value

An object of class smsgora_client, used by every other function.

Examples

client <- smsgora_client("sgk_your_key")

Add a webhook

Description

Add a webhook

Usage

smsgora_create_webhook(client, url, events, device_id = NULL)

Arguments

client

A client from smsgora_client().

url

HTTPS address that receives the events.

events

Character vector of events, e.g. "sms.received", "sms.failed".

device_id

Optional phone ID to limit the webhook to one phone.

Value

The new webhook, including its signing secret.

Examples

## Not run: 
smsgora_create_webhook(smsgora_client("sgk_your_key"),
                       "https://example.com/sms-hook", c("sms.received", "sms.failed"))

## End(Not run)

Remove a webhook

Description

Remove a webhook

Usage

smsgora_delete_webhook(client, webhook_id)

Arguments

client

A client from smsgora_client().

webhook_id

Webhook ID.

Value

The API confirmation.

Examples

## Not run: 
smsgora_delete_webhook(smsgora_client("sgk_your_key"), 4)

## End(Not run)

Get your account

Description

Get your account

Usage

smsgora_get_account(client)

Arguments

client

A client from smsgora_client().

Value

Your plan, limits and usage.

Examples

## Not run: 
smsgora_get_account(smsgora_client("sgk_your_key"))

## End(Not run)

Get a bulk batch

Description

Get a bulk batch

Usage

smsgora_get_batch(client, batch_id)

Arguments

client

A client from smsgora_client().

batch_id

Batch ID returned by smsgora_send_bulk_sms().

Value

The batch and its progress.

Examples

## Not run: 
smsgora_get_batch(smsgora_client("sgk_your_key"), 311)

## End(Not run)

Get one phone

Description

Get one phone

Usage

smsgora_get_device(client, device_id)

Arguments

client

A client from smsgora_client().

device_id

Phone ID.

Value

The phone and its status.

Examples

## Not run: 
smsgora_get_device(smsgora_client("sgk_your_key"), 12)

## End(Not run)

Get one message

Description

Get one message

Usage

smsgora_get_message(client, message_id)

Arguments

client

A client from smsgora_client().

message_id

Message ID.

Value

The message, with its status (queued, dispatched, sent, delivered, failed or cancelled).

Examples

## Not run: 
smsgora_get_message(smsgora_client("sgk_your_key"), 1873)

## End(Not run)

List your linked phones

Description

List your linked phones

Usage

smsgora_list_devices(client)

Arguments

client

A client from smsgora_client().

Value

A list of phones with their status.

Examples

## Not run: 
smsgora_list_devices(smsgora_client("sgk_your_key"))

## End(Not run)

List messages

Description

List messages

Usage

smsgora_list_messages(client, ...)

Arguments

client

A client from smsgora_client().

...

Filters passed as query parameters: direction, status, device_id, phone, since, page, limit.

Value

A list with the matching messages and paging details.

Examples

## Not run: 
smsgora_list_messages(smsgora_client("sgk_your_key"), status = "failed", limit = 20)

## End(Not run)

List received SMS

Description

List received SMS

Usage

smsgora_list_received_sms(client, device_id = NULL, ...)

Arguments

client

A client from smsgora_client().

device_id

Optional phone ID; all phones when NULL.

...

Query parameters such as page and limit.

Value

A list with the received messages and paging details.

Examples

## Not run: 
smsgora_list_received_sms(smsgora_client("sgk_your_key"), device_id = 12, limit = 10)

## End(Not run)

List your webhooks

Description

List your webhooks

Usage

smsgora_list_webhooks(client)

Arguments

client

A client from smsgora_client().

Value

A list of webhooks.

Examples

## Not run: 
smsgora_list_webhooks(smsgora_client("sgk_your_key"))

## End(Not run)

Call any SMS Gora endpoint

Description

Low-level access for endpoints that have no helper of their own.

Usage

smsgora_request(client, method, path, body = NULL, query = NULL)

Arguments

client

A client from smsgora_client().

method

HTTP method, e.g. "GET" or "POST".

path

Path after the base URL, e.g. "/batches/311".

body

Optional list sent as JSON.

query

Optional named list of query parameters.

Value

The data part of the API answer, as a list.

Examples

## Not run: 
client <- smsgora_client("sgk_your_key")
smsgora_request(client, "GET", "/account")

## End(Not run)

Send different texts to different people

Description

Bulk sending from one phone, up to 5,000 recipients per call.

Usage

smsgora_send_bulk_sms(client, device_id, messages, template = NULL)

Arguments

client

A client from smsgora_client().

device_id

ID of the phone to send from.

messages

A list of messages; each is a list with recipients (character vector) and an optional message.

template

Optional text used for messages that have no message.

Value

A list describing the batch, including its ID.

Examples

## Not run: 
client <- smsgora_client("sgk_your_key")
smsgora_send_bulk_sms(client, 12, list(
  list(recipients = "+250788123456", message = "Hi Alice, your table is ready"),
  list(recipients = c("+250722000000", "+250733000000"))
), template = "Thank you for visiting us")

## End(Not run)

Send an SMS

Description

Sends one text to one or more numbers (up to 1,000), from your best online phone or from the phone you choose.

Usage

smsgora_send_sms(
  client,
  to,
  message,
  device_id = NULL,
  sim_slot = NULL,
  schedule_at = NULL
)

Arguments

client

A client from smsgora_client().

to

Character vector of phone numbers in international format.

message

The text to send.

device_id

Optional ID of the phone to send from.

sim_slot

Optional SIM: 0 = SIM 1, 1 = SIM 2.

schedule_at

Optional ISO 8601 time to send later.

Value

A list with the queued message IDs.

Examples

## Not run: 
client <- smsgora_client("sgk_your_key")
smsgora_send_sms(client, "+250788123456", "Your order #1042 has shipped.")
smsgora_send_sms(client, c("+250788123456", "+250722000000"),
                 "Reminder: appointment tomorrow",
                 device_id = 12, sim_slot = 1, schedule_at = "2026-12-01T08:00:00Z")

## End(Not run)

Verify a webhook signature

Description

Checks the X-SmsGora-Signature header (⁠sha256=⁠ followed by the hex HMAC-SHA256 of the raw request body, keyed with your webhook secret). The comparison takes the same time whether or not the signature matches.

Usage

smsgora_verify_webhook(raw_body, signature, secret)

Arguments

raw_body

The raw request body, as a string or raw vector, exactly as received.

signature

Value of the X-SmsGora-Signature header.

secret

Your webhook secret.

Value

TRUE when the signature is valid, otherwise FALSE.

Examples

body <- '{"event":"sms.received"}'
sig <- "sha256=313fe9b54923f49c8b94d50c5b96fa44f3f5a7ca90ef52fd55afb2bfd3ae8f60"
smsgora_verify_webhook(body, sig, "whsec_test")