class Pinnacle::SendClient

def initialize(request_client:)

Returns:
  • (Pinnacle::SendClient) -

Parameters:
  • request_client (Pinnacle::RequestClient) --
def initialize(request_client:)
  @request_client = request_client
end

def mms(to:, from:, media_urls:, text: nil, status_callback: nil, request_options: nil)

Returns:
  • (Pinnacle::Send::SendMmsResponse) -

Parameters:
  • request_options (Pinnacle::RequestOptions) --
  • status_callback (String) -- Optional URL to receive a POST request when the message status changes. Read
  • media_urls (Array) -- The URLs of media to include. `jpeg`, `jpg`, `gif`, and `png` file types are
  • text (String) -- The MMS 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 mms(to:, from:, media_urls:, text: nil, 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,
      mediaUrls: media_urls,
      statusCallback: status_callback
    }.compact
    req.url "#{@request_client.get_url(request_options: request_options)}/send/mms"
  end
  Pinnacle::Send::SendMmsResponse.from_json(json_object: response.body)
end

def rcs(from:, to:, text: nil, media_url: nil, cards: nil, quick_replies: nil, fallback: nil, status_callback: nil,

Returns:
  • (Pinnacle::Send::SendRcsResponse) -

Parameters:
  • request_options (Pinnacle::RequestOptions) --
  • status_callback (String) -- Optional URL to receive a POST request when the message status changes. Read
  • fallback (Hash) -- Request of type Pinnacle::Send::RcsFallback, as a Hash
  • quick_replies (Array) -- Optional list of quick reply actions (max 10).Request of type Array, as a Hash
  • cards (Array) -- List of rich cards. Maximum of 10 cards.
  • media_url (String) -- Media URL to be included in the message.
  • text (String) -- Text content of the message.
  • to (String) -- The recipient's RCS-enabled phone number in E.164 format (e.g., +12345678901).
  • from (String) -- The id of the RCS agent sending the message.
def rcs(from:, to:, text: nil, media_url: nil, cards: nil, quick_replies: nil, fallback: nil, 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 || {}),
      from: from,
      to: to,
      text: text,
      mediaUrl: media_url,
      cards: cards,
      quickReplies: quick_replies,
      fallback: fallback,
      statusCallback: status_callback
    }.compact
    req.url "#{@request_client.get_url(request_options: request_options)}/send/rcs"
  end
  Pinnacle::Send::SendRcsResponse.from_json(json_object: response.body)
end

def sms(to:, from:, text:, status_callback: nil, request_options: nil)

Returns:
  • (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