Class: Sendly::RcsResource
- Inherits:
-
Object
- Object
- Sendly::RcsResource
- Defined in:
- lib/sendly/rcs_resource.rb
Overview
RCS resource — discover your RCS agents and pre-flight recipient capability.
RCS is a first-class Sendly channel: send branded rich messages — text
with suggested replies and actions, or rich cards — via
client.messages.send(channel: "rcs", ...). RCS agents are registered
by Sendly for your brand; contact support to set one up, then discover
it with Sendly::RcsAgentsResource#list.
Delivery is per-recipient: not every device or network supports RCS.
Text messages fall back to plain SMS automatically (billed as SMS)
unless you pass fallback_to_sms: false; rich cards have no SMS form
and only deliver to RCS-capable recipients. Use #capability to check
a recipient before sending.
RCS sends and capability checks require a live API key (+sk_live_v1_xxx+).
Instance Attribute Summary collapse
-
#agents ⇒ RcsAgentsResource
readonly
List registered agents.
Instance Method Summary collapse
-
#capability(to:, agent_id: nil) ⇒ RcsCapability
Check whether a recipient can receive RCS.
-
#initialize(client) ⇒ RcsResource
constructor
A new instance of RcsResource.
Constructor Details
#initialize(client) ⇒ RcsResource
Returns a new instance of RcsResource.
191 192 193 194 |
# File 'lib/sendly/rcs_resource.rb', line 191 def initialize(client) @client = client @agents = RcsAgentsResource.new(client) end |
Instance Attribute Details
#agents ⇒ RcsAgentsResource (readonly)
Returns List registered agents.
189 190 191 |
# File 'lib/sendly/rcs_resource.rb', line 189 def agents @agents end |
Instance Method Details
#capability(to:, agent_id: nil) ⇒ RcsCapability
Check whether a recipient can receive RCS.
Probes the recipient's device and network. When the recipient is not
capable, a text send falls back to plain SMS (unless the fallback is
disabled) and a card send fails with
rcs_not_supported_for_recipient.
213 214 215 216 217 218 219 220 |
# File 'lib/sendly/rcs_resource.rb', line 213 def capability(to:, agent_id: nil) raise ValidationError, "to is required" if to.nil? || to.to_s.empty? params = { to: to } params[:agentId] = agent_id if agent_id response = @client.get("/rcs/capability", params) RcsCapability.new(response) end |