Class: Pinnacle::Rcs::Client
- Inherits:
-
Object
- Object
- Pinnacle::Rcs::Client
- Defined in:
- lib/pinnacle/rcs/client.rb
Instance Method Summary collapse
-
#get_capabilities(request_options: {}, **params) ⇒ Hash[String, Pinnacle::Types::RcsCapability, nil]
Check RCS capabilities for one or more phone numbers.
-
#get_link(request_options: {}, **params) ⇒ Pinnacle::Types::RcsLinkResult
Generate a link for initiating an RCS conversation with your agent.
- #initialize(client:) ⇒ void constructor
-
#whitelist(request_options: {}, **params) ⇒ Pinnacle::Types::RcsWhitelistResponse
Whitelist a phone number for testing with your test RCS agent.
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/pinnacle/rcs/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#get_capabilities(request_options: {}, **params) ⇒ Hash[String, Pinnacle::Types::RcsCapability, nil]
Check RCS capabilities for one or more phone numbers.
This endpoint allows you to verify which RCS features (cards, buttons, etc.) are supported on specific phone numbers before sending RCS messages to them.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/pinnacle/rcs/client.rb', line 27 def get_capabilities(request_options: {}, **params) params = Pinnacle::Internal::Types::Utils.normalize_keys(params) request = Pinnacle::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "rcs/capabilities", body: Pinnacle::Rcs::Types::RcsCapabilitiesQuery.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Pinnacle::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Pinnacle::Types::RcsCapabilitiesResult.load(response.body) else error_class = Pinnacle::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_link(request_options: {}, **params) ⇒ Pinnacle::Types::RcsLinkResult
Generate a link for initiating an RCS conversation with your agent.
Users can click these links to start conversations with your RCS agent directly from websites, emails, or other applications.
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/pinnacle/rcs/client.rb', line 126 def get_link(request_options: {}, **params) params = Pinnacle::Internal::Types::Utils.normalize_keys(params) request = Pinnacle::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "rcs/link", body: Pinnacle::Rcs::Types::RcsLinkRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Pinnacle::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Pinnacle::Types::RcsLinkResult.load(response.body) else error_class = Pinnacle::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#whitelist(request_options: {}, **params) ⇒ Pinnacle::Types::RcsWhitelistResponse
Whitelist a phone number for testing with your test RCS agent.
## Overview During development and testing, RCS agents can only send messages to whitelisted phone numbers. Use this endpoint to whitelist specific phone numbers to send and receive messages from the test agent.
## Verification Process After whitelisting a number, you’ll need to complete verification:
-
Check the test device for message from “RBM Tester Management”
-
Click the “Make me a tester” button
-
Enter the separate 4-digit verification SMS code in the Pinnacle dashboard at: “‘ app.pinnacle.sh/dashboard/brands/brandId?campaignId=campaignId&campaignType=RCS “`
> **
> > If you whitelist a number that’s already whitelisted, you’ll receive a new message from “RBM Tester Management”. **You must click the “Make me a tester” button again to continue sending and receiving messages.**
> **Important Notes** > > - **Verification required:** Messages cannot be sent nor received until you have clicked the “Make me a tester” button on the test device. > - **Testing only:** This is only required for test agents. Production agents can message any RCS-enabled number. > - **Network limitations:** Whitelisting may be temporarily unavailable for some carriers but are usually restored shortly.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/pinnacle/rcs/client.rb', line 89 def whitelist(request_options: {}, **params) params = Pinnacle::Internal::Types::Utils.normalize_keys(params) request = Pinnacle::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "rcs/whitelist", body: Pinnacle::Rcs::Types::RcsWhitelistRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Pinnacle::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Pinnacle::Types::RcsWhitelistResponse.load(response.body) else error_class = Pinnacle::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |