class Pinnacle::SendClient
def sms(to:, from:, text:, status_callback: nil, request_options: nil)
-
(Pinnacle::Send::SendSmsResponse)-
Parameters:
-
request_options(Pinnacle::RequestOptions) -- -
status_callback(String) -- Optional URL to receive a POST request when the message status changes. Read -
text(String) -- The SMS message content (max 1600 characters). -
from(String) -- The sender's phone number in E.164 format. Must be owned by the user. -
to(String) -- The recipient's phone number in E.164 format (e.g., +12345678901).
def sms(to:, from:, text:, status_callback: nil, request_options: nil) response = @request_client.conn.post do |req| req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? req.headers["PINNACLE-API-Key"] = request_options.api_key unless request_options&.api_key.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(request_options&.additional_headers || {}) }.compact unless request_options.nil? || request_options&.additional_query_parameters.nil? req.params = { **(request_options&.additional_query_parameters || {}) }.compact end req.body = { **(request_options&.additional_body_parameters || {}), to: to, from: from, text: text, statusCallback: status_callback }.compact req.url "#{@request_client.get_url(request_options: request_options)}/send/sms" end Pinnacle::Send::SendSmsResponse.from_json(json_object: response.body) end