signalhouse-sms 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +40 -11
- data/lib/signalhouse_sms/client.rb +2 -1
- data/lib/signalhouse_sms/domains/auth.rb +4 -3
- data/lib/signalhouse_sms/domains/brands.rb +12 -48
- data/lib/signalhouse_sms/domains/campaigns.rb +13 -0
- data/lib/signalhouse_sms/domains/rcs.rb +164 -0
- data/lib/signalhouse_sms/domains/registrations.rb +50 -6
- data/lib/signalhouse_sms/domains/templates.rb +11 -1
- data/lib/signalhouse_sms/version.rb +1 -1
- data/lib/signalhouse_sms.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 130d8e54382b6f5a8b1ec875e29ee615c2b1f98f0b7ac6f7377badf468252d5b
|
|
4
|
+
data.tar.gz: 62399c15b508e39c9419fae36c6d1f1a1b4ac772a143eae77c96a57b34e69dea
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9321266636b7f303d6e11db8d63037baff8c6d227a9e3db72b90336366a35a333bdbd357704d216ba03b2dbfca7954c1f729cfcc62ddcf84a6d5f7f7448a6059
|
|
7
|
+
data.tar.gz: 6c6ac9ea20be7e4c43c2458c0f992ccae06651e557e04e09968be9839bd17e8d3705750893ea1d5a1305efe2806233001a407f193fa3004da72ccf82ac1459c3
|
data/README.md
CHANGED
|
@@ -147,22 +147,50 @@ result = client.brands.create_brand(
|
|
|
147
147
|
puts result
|
|
148
148
|
```
|
|
149
149
|
|
|
150
|
-
###
|
|
150
|
+
### Create a Toll-Free Brand
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
Some groups' toll-free brands are reviewed when they're submitted; `get_toll_free_requirements` says whether a group's are. A brand in such a group also needs five `tollFree` fields (`businessStructure`, `industry`, `contactEmail`, `contactJobTitle` and `contactJobLevel`), a `tollFree.countryCode` of `US` or `CA`, and a 2-letter `state`; any other group gets a 400 if it sends any of the five. The brand is `DCA_PENDING` until its business details pass review, then `DCA_ACTIVE`. If they don't pass, it becomes `DCA_REJECTED` with `tollFree.rejectionReason` saying why; fix it by creating the brand again with the corrected details. Its business details can't be changed after it's submitted.
|
|
153
153
|
|
|
154
154
|
```ruby
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
requirements = client.brands.get_toll_free_requirements(group_id: "G0000001", token: "your-jwt-token")
|
|
156
|
+
raise requirements["error"] unless requirements["success"]
|
|
157
|
+
|
|
158
|
+
toll_free = {
|
|
159
|
+
businessRegistrationType: "EIN",
|
|
160
|
+
legalEntityType: "PRIVATE_COMPANY",
|
|
161
|
+
taxId: "123456789",
|
|
162
|
+
countryCode: "US",
|
|
163
|
+
supportPhone: "15551234567"
|
|
164
|
+
}
|
|
165
|
+
if requirements["data"]["reviewsBusinessOnSubmit"]
|
|
166
|
+
toll_free.merge!(
|
|
167
|
+
businessStructure: "CORPORATION",
|
|
168
|
+
industry: "TECHNOLOGY",
|
|
169
|
+
contactEmail: "jane@mycompany.com",
|
|
170
|
+
contactJobTitle: "Operations Manager",
|
|
171
|
+
contactJobLevel: "DIRECTOR"
|
|
172
|
+
)
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
result = client.brands.create_toll_free_brand(
|
|
176
|
+
brand_data: {
|
|
177
|
+
subgroupId: "SG000001",
|
|
178
|
+
displayName: "My Brand",
|
|
179
|
+
companyName: "My Company Inc",
|
|
180
|
+
street: "123 Main St",
|
|
181
|
+
city: "New York",
|
|
182
|
+
state: "NY",
|
|
183
|
+
postalCode: "10001",
|
|
184
|
+
email: "contact@mycompany.com",
|
|
185
|
+
firstName: "Jane",
|
|
186
|
+
lastName: "Doe",
|
|
187
|
+
website: "https://mycompany.com",
|
|
188
|
+
tollFree: toll_free
|
|
189
|
+
},
|
|
158
190
|
token: "your-jwt-token"
|
|
159
191
|
)
|
|
160
192
|
|
|
161
|
-
|
|
162
|
-
result["data"]["businessVerifications"].each do |verification|
|
|
163
|
-
puts "#{verification['businessVerificationId']}: #{verification['status']}"
|
|
164
|
-
end
|
|
165
|
-
end
|
|
193
|
+
puts result
|
|
166
194
|
```
|
|
167
195
|
|
|
168
196
|
### Using Token Override
|
|
@@ -224,7 +252,7 @@ client.users.admin.create_internal_user(
|
|
|
224
252
|
|--------|----------|---------|
|
|
225
253
|
| Auth | `client.auth` | `login`, `reset_password`, `get_auth_history`, `get_oauth_links`, `create_oauth_link`, `create_oauth_reauth`, `confirm_oauth_reauth`, `confirm_oauth_link`, `delete_oauth_link`, `get_oauth_authorization_url` |
|
|
226
254
|
| Billing | `client.billing` | `get_transaction_history`, `get_wallet`, `update_wallet`, `get_payment_methods`, `add_funds`, `add_payment_method`, `remove_payment_method`, `get_invoice_details`, `get_fees` |
|
|
227
|
-
| Brands | `client.brands` | `get_brands`, `get_external_vetting`, `create_brand`, `
|
|
255
|
+
| Brands | `client.brands` | `get_brands`, `get_external_vetting`, `create_brand`, `create_toll_free_brand`, `get_toll_free_requirements`, `transfer_brand`, `create_external_vetting`, `update_brand`, `revet_brand`, `delete_brand` |
|
|
228
256
|
| Campaigns | `client.campaigns` | `get_campaigns`, `create_campaign`, `update_campaign`, `delete_campaign` |
|
|
229
257
|
| Campaigns Admin | `client.campaigns.admin` | `approve_campaign`, `reject_campaign` |
|
|
230
258
|
| Groups | `client.groups` | `get_group`, `update_group`, `get_sso_configuration`, `save_sso_connection`, `delete_sso_connection`, `add_sso_domain`, `verify_sso_domain`, `remove_sso_domain` |
|
|
@@ -238,6 +266,7 @@ client.users.admin.create_internal_user(
|
|
|
238
266
|
| Subscriptions | `client.subscriptions` | `get_subscriptions`, `subscribe`, `unsubscribe` |
|
|
239
267
|
| Subscriptions Admin | `client.subscriptions.admin` | `get_templates`, `create_template`, `update_template`, `delete_template`, `create_custom_subscription` |
|
|
240
268
|
| Templates | `client.templates` | `create`, `list`, `get`, `update`, `publish`, `archive`, `versions`, `validate`, `capabilities`, `upload_media` |
|
|
269
|
+
| RCS Agents | `client.rcs.agents` | `create`, `list`, `get`, `update`, `validate`, `submit`, `archive`, `upload_asset` |
|
|
241
270
|
| Users | `client.users` | `get_users`, `create_user`, `create_service_user`, `update_user`, `delete_user`, `get_notification_preferences`, `update_notification_preferences` |
|
|
242
271
|
| Users Admin | `client.users.admin` | `get_users`, `create_internal_user` |
|
|
243
272
|
| Webhooks | `client.webhooks` | `get_webhooks`, `create_webhook`, `update_webhook`, `delete_webhook` |
|
|
@@ -5,7 +5,7 @@ require "securerandom"
|
|
|
5
5
|
module SignalHouseSms
|
|
6
6
|
class Client
|
|
7
7
|
attr_reader :agents, :auth, :billing, :brands, :campaigns, :groups, :landings,
|
|
8
|
-
:messages, :notifications, :numbers, :registrations, :onboarding,
|
|
8
|
+
:messages, :notifications, :numbers, :registrations, :onboarding, :rcs,
|
|
9
9
|
:shortlinks, :subgroups, :subscriptions, :templates, :tickets, :users, :voice, :webhooks
|
|
10
10
|
|
|
11
11
|
# Initialize a new SignalHouse client.
|
|
@@ -32,6 +32,7 @@ module SignalHouseSms
|
|
|
32
32
|
@numbers = Numbers.new(json_client, multipart_client, enable_admin)
|
|
33
33
|
@registrations = Registrations.new(json_client, enable_admin)
|
|
34
34
|
@onboarding = Onboarding.new(json_client, enable_admin)
|
|
35
|
+
@rcs = Rcs.new(json_client, multipart_client)
|
|
35
36
|
@shortlinks = Shortlinks.new(json_client, enable_admin)
|
|
36
37
|
@subgroups = Subgroups.new(json_client, enable_admin)
|
|
37
38
|
@subscriptions = Subscriptions.new(json_client, enable_admin)
|
|
@@ -114,8 +114,9 @@ module SignalHouseSms
|
|
|
114
114
|
# Start signing in again with a provider already linked to the caller's account, to confirm it's them.
|
|
115
115
|
# Returns { reauthTicket, reauthSecret, expiresInSeconds }. Keep reauthSecret in the client that started the
|
|
116
116
|
# flow: it is returned only here, and confirm_oauth_reauth needs it. Pass reauthTicket as reauth_ticket: to
|
|
117
|
-
# get_oauth_authorization_url and navigate the browser there. provider is "
|
|
118
|
-
#
|
|
117
|
+
# get_oauth_authorization_url and navigate the browser there. provider is "microsoft", "apple" or "sso"
|
|
118
|
+
# (Google is refused with a 400 because it can't confirm a fresh sign-in; confirm with a code instead); the
|
|
119
|
+
# ticket is single-use and valid 2 minutes, and nothing is spent. The browser comes back to
|
|
119
120
|
# /Settings/Security with a single-use `pendingReauth` (the session that started it redeems it with confirm_oauth_reauth) or `reauthError` (reauth_wrong_account, reauth_unsupported,
|
|
120
121
|
# reauth_stale, invalid_state, sso_not_configured, access_denied or provider_error).
|
|
121
122
|
def create_oauth_reauth(provider:, **opts)
|
|
@@ -150,7 +151,7 @@ module SignalHouseSms
|
|
|
150
151
|
|
|
151
152
|
# DELETE /auth/oauth/:provider/link
|
|
152
153
|
# Unlink a sign-in provider (provider may be "sso") from the caller's account. Refused (400) if it is the
|
|
153
|
-
# account's only way to sign in. Requires a fresh confirm_two_factor_identity from the same session (403 otherwise).
|
|
154
|
+
# account's only way to sign in. With 2FA on and no password, the last linked Microsoft, Apple or SSO sign-in is refused (400) too. Requires a fresh confirm_two_factor_identity from the same session (403 otherwise).
|
|
154
155
|
def delete_oauth_link(provider:, **opts)
|
|
155
156
|
@client.require_params("provider" => provider)
|
|
156
157
|
@client.request("/auth/oauth/#{CGI.escape(provider.to_s)}/link", method: :delete, token: opts[:token], headers: opts[:headers])
|
|
@@ -14,6 +14,9 @@ module SignalHouseSms
|
|
|
14
14
|
# Each brand carries `carrierSuspensions` (carrier brand suspension rules; active while liftedAt is null).
|
|
15
15
|
# current_toll_free_carrier: true, with group_id or subgroup_id, returns only toll-free brands on the group's
|
|
16
16
|
# current toll-free carrier, the ones a new toll-free campaign in that group can use.
|
|
17
|
+
# Each toll-free brand carries tollFree.reviewsBusinessOnSubmit: whether it's reviewed when it's submitted and keeps
|
|
18
|
+
# its business details from then on. A brand reviewed on submit also carries tollFree's businessStructure, industry,
|
|
19
|
+
# contactEmail, contactJobTitle, contactJobLevel and rejectionReason (why it was rejected, or null).
|
|
17
20
|
def get_brands(id: nil, subgroup_id: nil, group_id: nil, page: nil, limit: nil, status: nil, registration_type: nil, current_toll_free_carrier: nil, **opts)
|
|
18
21
|
token = opts[:token]
|
|
19
22
|
headers = HttpClient.headers_for(opts)
|
|
@@ -48,12 +51,11 @@ module SignalHouseSms
|
|
|
48
51
|
# For Toll-Free, brandId is a
|
|
49
52
|
# TFNB-prefixed id when assigned; otherwise null — poll by record _id.
|
|
50
53
|
#
|
|
51
|
-
#
|
|
52
|
-
#
|
|
53
|
-
#
|
|
54
|
-
#
|
|
55
|
-
#
|
|
56
|
-
# verification's values replace any that are sent. It can't be changed after creation.
|
|
54
|
+
# When get_toll_free_requirements says the group's toll-free brands are reviewed on submit, tollFree also needs
|
|
55
|
+
# businessStructure, industry, contactEmail, contactJobTitle and contactJobLevel, countryCode must be US or CA and
|
|
56
|
+
# state a 2-letter state or province code. Any other group gets 400 if it sends any of the five. Such a brand is
|
|
57
|
+
# DCA_PENDING until it's reviewed, then DCA_ACTIVE, or DCA_REJECTED with tollFree.rejectionReason saying why. Its
|
|
58
|
+
# business details can't change after it's submitted, so a rejected brand is fixed by creating it again.
|
|
57
59
|
def create_toll_free_brand(brand_data:, **opts)
|
|
58
60
|
@client.require_params("brandData" => brand_data)
|
|
59
61
|
token = opts[:token]
|
|
@@ -61,52 +63,14 @@ module SignalHouseSms
|
|
|
61
63
|
@client.request("/brand/toll-free", method: :post, body: brand_data, token: token, headers: headers)
|
|
62
64
|
end
|
|
63
65
|
|
|
64
|
-
# GET /brand/
|
|
65
|
-
#
|
|
66
|
-
|
|
67
|
-
def get_business_verifications(group_id:, subgroup_id: nil, **opts)
|
|
66
|
+
# GET /brand/toll-free-requirements/:groupId
|
|
67
|
+
# Whether the group's new toll-free brands are reviewed on submit: { groupId, reviewsBusinessOnSubmit }.
|
|
68
|
+
def get_toll_free_requirements(group_id:, **opts)
|
|
68
69
|
@client.require_params("groupId" => group_id)
|
|
69
70
|
token = opts[:token]
|
|
70
71
|
headers = HttpClient.headers_for(opts)
|
|
71
72
|
safe_group_id = CGI.escape(group_id.to_s)
|
|
72
|
-
|
|
73
|
-
@client.request("/brand/business-verification/#{safe_group_id}#{qs}", method: :get, token: token, headers: headers)
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
# GET /brand/business-verification/:groupId/:businessVerificationId
|
|
77
|
-
# Get one of a group's business verifications by its ID, plus required. 404 when it isn't one of the group's.
|
|
78
|
-
def get_business_verification(group_id:, business_verification_id:, **opts)
|
|
79
|
-
@client.require_params("groupId" => group_id, "businessVerificationId" => business_verification_id)
|
|
80
|
-
token = opts[:token]
|
|
81
|
-
headers = HttpClient.headers_for(opts)
|
|
82
|
-
safe_group_id = CGI.escape(group_id.to_s)
|
|
83
|
-
safe_business_verification_id = CGI.escape(business_verification_id.to_s)
|
|
84
|
-
@client.request("/brand/business-verification/#{safe_group_id}/#{safe_business_verification_id}", method: :get, token: token, headers: headers)
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
# POST /brand/business-verification/:groupId?subgroupId=...
|
|
88
|
-
# Create and submit a new business verification. Review usually takes 1–2 business days; once it is VERIFIED, a new
|
|
89
|
-
# toll-free brand can use it as tollFree.businessVerificationId. subgroup_id is sent only when given and must name an
|
|
90
|
-
# active subgroup of the group. A group that verifies each subgroup's business separately requires it.
|
|
91
|
-
def create_business_verification(group_id:, details:, subgroup_id: nil, **opts)
|
|
92
|
-
@client.require_params("groupId" => group_id, "details" => details)
|
|
93
|
-
token = opts[:token]
|
|
94
|
-
headers = HttpClient.headers_for(opts)
|
|
95
|
-
safe_group_id = CGI.escape(group_id.to_s)
|
|
96
|
-
qs = @client.get_query_string(subgroupId: subgroup_id)
|
|
97
|
-
@client.request("/brand/business-verification/#{safe_group_id}#{qs}", method: :post, body: details, token: token, headers: headers)
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
# PUT /brand/business-verification/:groupId/:businessVerificationId
|
|
101
|
-
# Correct and resubmit a business verification. Allowed only while it needs changes (400 otherwise); the toll-free
|
|
102
|
-
# brands that use it stay pending until it is verified.
|
|
103
|
-
def update_business_verification(group_id:, business_verification_id:, details:, **opts)
|
|
104
|
-
@client.require_params("groupId" => group_id, "businessVerificationId" => business_verification_id, "details" => details)
|
|
105
|
-
token = opts[:token]
|
|
106
|
-
headers = HttpClient.headers_for(opts)
|
|
107
|
-
safe_group_id = CGI.escape(group_id.to_s)
|
|
108
|
-
safe_business_verification_id = CGI.escape(business_verification_id.to_s)
|
|
109
|
-
@client.request("/brand/business-verification/#{safe_group_id}/#{safe_business_verification_id}", method: :put, body: details, token: token, headers: headers)
|
|
73
|
+
@client.request("/brand/toll-free-requirements/#{safe_group_id}", method: :get, token: token, headers: headers)
|
|
110
74
|
end
|
|
111
75
|
|
|
112
76
|
# POST /brand/short-code — create a local Short Code brand in PENDING_APPROVAL for manual review.
|
|
@@ -70,6 +70,19 @@ module SignalHouseSms
|
|
|
70
70
|
@client.request("/campaign/throughput-limits#{qs}", method: :get, token: token, headers: headers)
|
|
71
71
|
end
|
|
72
72
|
|
|
73
|
+
# Get today's T-Mobile usage against the daily limit for every active campaign in a group that has one: the same limits and counter as get_campaign_throughput_limits, for the whole group in one
|
|
74
|
+
# call. Returns [{ campaignId, brandId, brandName, usecase, tmobile: { tier, dailyLimit, usedToday: { date, segments, resetsAt } } }].
|
|
75
|
+
# Campaigns without a T-Mobile limit (unverified brand, GOVERNMENT entity, PUBLIC_SAFETY_RESTRICTED usecase) are left out. The counter is per brand EIN and UTC day, so every campaign of a brand shows the same usage; a LOW_VOLUME campaign's limit is 2,000 whatever the brand's score.
|
|
76
|
+
#
|
|
77
|
+
# GET /campaign/throughput-usage?groupId=...
|
|
78
|
+
def get_group_throughput_usage(group_id:, **opts)
|
|
79
|
+
@client.require_params("groupId" => group_id)
|
|
80
|
+
token = opts[:token]
|
|
81
|
+
headers = HttpClient.headers_for(opts)
|
|
82
|
+
qs = @client.get_query_string(groupId: group_id)
|
|
83
|
+
@client.request("/campaign/throughput-usage#{qs}", method: :get, token: token, headers: headers)
|
|
84
|
+
end
|
|
85
|
+
|
|
73
86
|
# POST /campaign
|
|
74
87
|
# Optional campaign_data[:sampleMediaIds] (10DLC only): up to 5 mediaId strings from
|
|
75
88
|
# upload_sample_media, attached to the TCR campaign as sample MMS media for carrier review.
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SignalHouseSms
|
|
4
|
+
# RCS agents under /rcs/agent. An agent links one 10DLC brand and one 10DLC campaign: the campaign's numbers are the
|
|
5
|
+
# SMS fallback, and the brand and campaign supply the company identity and consent text for the carrier launch. One
|
|
6
|
+
# brand or campaign can serve many agents. An agent is a registration (type RCS_AGENT, id RCSA...), so the
|
|
7
|
+
# registrations methods read and edit the same record. 404 while the environment's RCS switch is off; 400 while the
|
|
8
|
+
# group's rcsEnabled flag is off.
|
|
9
|
+
class RcsAgents
|
|
10
|
+
# Default for campaign_id, use_case and default_fallback: leaving one out omits it and nil sends null.
|
|
11
|
+
UNSET = Object.new.freeze
|
|
12
|
+
|
|
13
|
+
def initialize(client, multipart_client)
|
|
14
|
+
@client = client
|
|
15
|
+
@multipart_client = multipart_client
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# POST /rcs/agent
|
|
19
|
+
# Create an agent draft on a 10DLC brand (carrier brand ID, provisional UUID or _id), optionally with campaign_id, a
|
|
20
|
+
# campaign ID or _id of that brand (required before submit). The agent's subgroup is the brand's. agent is the
|
|
21
|
+
# profile { name, description, color, logoUrl, heroUrl, phone, website, email, phoneLabel, websiteLabel, emailLabel
|
|
22
|
+
# (captions, max 40; submit defaults them to Call, Website and Email), privacyPolicyUrl, termsUrl }; consent is the
|
|
23
|
+
# launch text, every field required before the launch request, and blank consent fields fill from the linked
|
|
24
|
+
# campaign; contact is { firstName, lastName, role, email, mobile }, the individual at the brand the carrier
|
|
25
|
+
# partner's reviewers may write to, required in full before the launch request. use_case
|
|
26
|
+
# is OTP, TRANSACTIONAL, PROMOTIONAL or MULTI_USE (required before submit); billing_category defaults to
|
|
27
|
+
# NON_CONVERSATIONAL and submit refuses CONVERSATIONAL; default_fallback is { mode, channel, from }; excluded_carriers
|
|
28
|
+
# is [] or ["T_MOBILE"] (the carrier partner's carrier name); testers holds up to 200 tester numbers. Returns 201
|
|
29
|
+
# with the agent (status DRAFT).
|
|
30
|
+
def create(brand_id:, campaign_id: UNSET, agent: nil, consent: nil, contact: nil, use_case: UNSET, billing_category: nil,
|
|
31
|
+
default_fallback: UNSET, excluded_carriers: nil, testers: nil, **opts)
|
|
32
|
+
@client.require_params("brandId" => brand_id)
|
|
33
|
+
payload = agent_payload(brand_id, campaign_id, agent, consent, use_case, billing_category, default_fallback,
|
|
34
|
+
excluded_carriers, testers, contact)
|
|
35
|
+
@client.request("/rcs/agent", method: :post, body: payload, token: opts[:token], headers: HttpClient.headers_for(opts))
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# GET /rcs/agent?...
|
|
39
|
+
# List agents, newest first. status is DRAFT, PENDING_REVIEW, REJECTED, AGENT_CREATING or ARCHIVED, one or a list
|
|
40
|
+
# (String or Array, sent comma-separated). brand_id / campaign_id return the agents linked to that 10DLC brand or
|
|
41
|
+
# campaign. limit defaults to 25 (max 100). Response: { data: [agents], total, page, limit }.
|
|
42
|
+
def list(group_id: nil, subgroup_id: nil, status: nil, brand_id: nil, campaign_id: nil, page: nil, limit: nil, **opts)
|
|
43
|
+
qs = @client.get_query_string(
|
|
44
|
+
groupId: group_id, subgroupId: subgroup_id, status: status, brandId: brand_id, campaignId: campaign_id,
|
|
45
|
+
page: page, limit: limit
|
|
46
|
+
)
|
|
47
|
+
@client.request("/rcs/agent#{qs}", method: :get, token: opts[:token], headers: HttpClient.headers_for(opts))
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# GET /rcs/agent/:agentId
|
|
51
|
+
# One agent with the live state of its brand and campaign links.
|
|
52
|
+
def get(agent_id:, **opts)
|
|
53
|
+
agent_request(agent_id, "", :get, nil, opts)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# PUT /rcs/agent/:agentId
|
|
57
|
+
# Edit an agent while it may change: a draft, a Signal House rejection, a request for changes, or an agent in
|
|
58
|
+
# testing (the change is pushed to the carrier partner); only the arguments passed are sent. agent, consent and
|
|
59
|
+
# contact merge field by field and every other key replaces. brand_id relinks to another 10DLC brand of the same
|
|
60
|
+
# subgroup (locked once the agent exists at the partner); campaign_id: nil unlinks the campaign; use_case: nil and
|
|
61
|
+
# default_fallback: nil clear those fields; billing_category is locked once a launch was requested. 409 in any
|
|
62
|
+
# other status. Returns the agent.
|
|
63
|
+
def update(agent_id:, brand_id: nil, campaign_id: UNSET, agent: nil, consent: nil, contact: nil, use_case: UNSET,
|
|
64
|
+
billing_category: nil, default_fallback: UNSET, excluded_carriers: nil, testers: nil, **opts)
|
|
65
|
+
payload = agent_payload(brand_id, campaign_id, agent, consent, use_case, billing_category, default_fallback,
|
|
66
|
+
excluded_carriers, testers, contact)
|
|
67
|
+
agent_request(agent_id, "", :put, payload, opts)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# POST /rcs/agent/:agentId/validate
|
|
71
|
+
# Check an agent against every submit requirement without writing.
|
|
72
|
+
# Returns { valid, errors: [{ field, reason }], warnings: [{ field, reason }] }.
|
|
73
|
+
def validate(agent_id:, **opts)
|
|
74
|
+
agent_request(agent_id, "/validate", :post, nil, opts)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# POST /rcs/agent/:agentId/submit
|
|
78
|
+
# Submit a draft: create the agent at the carrier partner, with no review first. It needs the full profile, a use
|
|
79
|
+
# case and NON_CONVERSATIONAL billing; otherwise a 400 whose details carry { code: "REGISTRATION_INCOMPLETE",
|
|
80
|
+
# errors, warnings }. Returns the agent (status AGENT_CREATING, then IN_TESTING once the partner reports it ready).
|
|
81
|
+
def submit(agent_id:, **opts)
|
|
82
|
+
agent_request(agent_id, "/submit", :post, nil, opts)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# POST /registration/:agentId/launch (the agent is a registration)
|
|
86
|
+
# Request the agent's launch: the launch requirements are checked and the agent goes to Signal House review (status
|
|
87
|
+
# PENDING_REVIEW), whose approval files the launch with the carrier partner. Allowed from IN_TESTING, REJECTED and
|
|
88
|
+
# CARRIER_REJECTED (409 otherwise); a failed requirement is a 400 whose details carry
|
|
89
|
+
# { code: "REGISTRATION_INCOMPLETE", errors, warnings }. Returns the agent (status PENDING_REVIEW).
|
|
90
|
+
def launch(agent_id:, **opts)
|
|
91
|
+
@client.require_params("agentId" => agent_id)
|
|
92
|
+
safe_id = CGI.escape(agent_id.to_s)
|
|
93
|
+
@client.request("/registration/#{safe_id}/launch", method: :post, token: opts[:token], headers: HttpClient.headers_for(opts))
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# POST /rcs/agent/:agentId/archive
|
|
97
|
+
# Archive an agent. Returns the agent (status ARCHIVED).
|
|
98
|
+
def archive(agent_id:, **opts)
|
|
99
|
+
agent_request(agent_id, "/archive", :post, nil, opts)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# POST /rcs/agent/:agentId/testers/:phoneNumber/resend
|
|
103
|
+
# Resend a tester's expired invitation, which starts a new 24 hours for the tester to accept it. phone_number is a US
|
|
104
|
+
# number, with or without the +. The number must be a tester on the agent (404) and its invitation must be EXPIRED
|
|
105
|
+
# (409); up to 20 invitations go out a day (429). Returns the agent.
|
|
106
|
+
def resend_tester_invite(agent_id:, phone_number:, **opts)
|
|
107
|
+
@client.require_params("phoneNumber" => phone_number)
|
|
108
|
+
agent_request(agent_id, "/testers/#{CGI.escape(phone_number.to_s)}/resend", :post, nil, opts)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# POST /rcs/agent/:agentId/asset (multipart: kind, file)
|
|
112
|
+
# Host the agent's logo (224 x 224 px, 50 KB max) or hero image (1440 x 448 px, 200 KB max), PNG or JPEG, and set
|
|
113
|
+
# it on the draft; images of any other size are refused. kind is "logo" or "hero". file is an IO or a
|
|
114
|
+
# { filename:, io:, content_type: } hash; file_name names an IO part. Returns the agent with the new URL.
|
|
115
|
+
def upload_asset(agent_id:, kind:, file:, file_name: nil, **opts)
|
|
116
|
+
@client.require_params("agentId" => agent_id, "kind" => kind, "file" => file)
|
|
117
|
+
safe_id = CGI.escape(agent_id.to_s)
|
|
118
|
+
@multipart_client.request("/rcs/agent/#{safe_id}/asset", method: :post, body: asset_form(kind, file, file_name),
|
|
119
|
+
token: opts[:token], headers: HttpClient.headers_for(opts))
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
private
|
|
123
|
+
|
|
124
|
+
# Send a JSON request to /rcs/agent/:agentId plus suffix after checking agent_id.
|
|
125
|
+
def agent_request(agent_id, suffix, method, body, opts)
|
|
126
|
+
@client.require_params("agentId" => agent_id)
|
|
127
|
+
safe_id = CGI.escape(agent_id.to_s)
|
|
128
|
+
@client.request("/rcs/agent/#{safe_id}#{suffix}", method: method, body: body, token: opts[:token],
|
|
129
|
+
headers: HttpClient.headers_for(opts))
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Agent create/update body: nil omits a field, except campaign_id, use_case and default_fallback, where UNSET omits
|
|
133
|
+
# it and nil sends null.
|
|
134
|
+
def agent_payload(brand_id, campaign_id, agent, consent, use_case, billing_category, default_fallback,
|
|
135
|
+
excluded_carriers, testers, contact = nil)
|
|
136
|
+
payload = { brandId: brand_id, agent: agent, consent: consent, contact: contact, billingCategory: billing_category,
|
|
137
|
+
excludedCarriers: excluded_carriers, testers: testers }.compact
|
|
138
|
+
{ campaignId: campaign_id, useCase: use_case, defaultFallback: default_fallback }.each do |key, value|
|
|
139
|
+
payload[key] = value unless value.equal?(UNSET)
|
|
140
|
+
end
|
|
141
|
+
payload
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Multipart fields kind and file; an IO part is named file_name, its path's basename, or "upload".
|
|
145
|
+
def asset_form(kind, file, file_name)
|
|
146
|
+
part = if file.is_a?(Hash)
|
|
147
|
+
file_name.nil? ? file : file.merge(filename: file_name)
|
|
148
|
+
else
|
|
149
|
+
{ filename: file_name || (file.respond_to?(:path) ? File.basename(file.path) : "upload"), io: file }
|
|
150
|
+
end
|
|
151
|
+
{ "kind" => kind.to_s, "file" => part }
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# RCS (Google RBM) resources, accessed via `client.rcs`. Templates for RCS live under `client.templates`.
|
|
156
|
+
# * client.rcs.agents — RCS agents linked to a 10DLC brand and campaign
|
|
157
|
+
class Rcs
|
|
158
|
+
attr_reader :agents
|
|
159
|
+
|
|
160
|
+
def initialize(client, multipart_client)
|
|
161
|
+
@agents = RcsAgents.new(client, multipart_client)
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
end
|
|
@@ -40,15 +40,16 @@ module SignalHouseSms
|
|
|
40
40
|
# SIGNAL_HOUSE_REJECTED, SUBMITTING, PENDING_PROVIDER, NEEDS_INFORMATION, PAYMENT_REQUIRED, APPROVED, REJECTED,
|
|
41
41
|
# CANCELLED, PENDING_DELETE, DELETED, EXPIRED, RECONCILIATION_REQUIRED. limit is at most 100.
|
|
42
42
|
# phone_number filters to registrations holding this phone number.
|
|
43
|
+
# brand_id / campaign_id (RCS agents only) filter to agents linked to that 10DLC brand or campaign.
|
|
43
44
|
# sort_by is createdAt (default), subgroupId, registrationId, region or status; sort_order is asc or desc (default).
|
|
44
45
|
# Response: { data, totalCount, page, limit }.
|
|
45
46
|
def get_registrations(group_id: nil, subgroup_id: nil, region: nil, type: nil, kind: nil, status: nil,
|
|
46
|
-
parent_registration_id: nil, phone_number: nil,
|
|
47
|
-
limit: nil, **opts)
|
|
47
|
+
parent_registration_id: nil, phone_number: nil, brand_id: nil, campaign_id: nil,
|
|
48
|
+
sort_by: nil, sort_order: nil, page: nil, limit: nil, **opts)
|
|
48
49
|
qs = @client.get_query_string(
|
|
49
50
|
groupId: group_id, subgroupId: subgroup_id, region: region, type: type, kind: kind, status: status,
|
|
50
|
-
parentRegistrationId: parent_registration_id, phoneNumber: phone_number,
|
|
51
|
-
page: page, limit: limit
|
|
51
|
+
parentRegistrationId: parent_registration_id, phoneNumber: phone_number, brandId: brand_id,
|
|
52
|
+
campaignId: campaign_id, sortBy: sort_by, sortOrder: sort_order, page: page, limit: limit
|
|
52
53
|
)
|
|
53
54
|
@client.request("/registration#{qs}", method: :get, token: opts[:token], headers: HttpClient.headers_for(opts))
|
|
54
55
|
end
|
|
@@ -61,10 +62,53 @@ module SignalHouseSms
|
|
|
61
62
|
@client.request("/registration/#{safe_id}", method: :get, token: opts[:token], headers: HttpClient.headers_for(opts))
|
|
62
63
|
end
|
|
63
64
|
|
|
65
|
+
# PUT /registration/:registrationId
|
|
66
|
+
# Edit a draft, or a registration Signal House rejected, before submitting it (types that keep drafts, such as
|
|
67
|
+
# RCS_AGENT). data is a partial of the type's create fields: for RCS_AGENT agent and consent merge field by field,
|
|
68
|
+
# every other key replaces, and { campaignId: nil } unlinks the campaign. 409 once submitted. Returns the
|
|
69
|
+
# updated registration.
|
|
70
|
+
def update_registration(registration_id:, data:, **opts)
|
|
71
|
+
@client.require_params("registrationId" => registration_id, "data" => data)
|
|
72
|
+
safe_id = CGI.escape(registration_id.to_s)
|
|
73
|
+
@client.request("/registration/#{safe_id}", method: :put, body: data, token: opts[:token], headers: HttpClient.headers_for(opts))
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# POST /registration/:registrationId/validate
|
|
77
|
+
# Check a draft against every submit requirement and the live state of its links, without writing.
|
|
78
|
+
# Returns { valid, errors: [{ field, reason }], warnings: [{ field, reason }] }.
|
|
79
|
+
def validate_registration(registration_id:, **opts)
|
|
80
|
+
@client.require_params("registrationId" => registration_id)
|
|
81
|
+
safe_id = CGI.escape(registration_id.to_s)
|
|
82
|
+
@client.request("/registration/#{safe_id}/validate", method: :post, token: opts[:token], headers: HttpClient.headers_for(opts))
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# POST /registration/:registrationId/submit
|
|
86
|
+
# Submit a draft. A type Signal House reviews goes to SIGNAL_HOUSE_REVIEW; a type it does not (RCS_AGENT) goes to
|
|
87
|
+
# SUBMITTING and is filed with the provider at once. A draft that fails a requirement gets a 400 whose details carry
|
|
88
|
+
# { code: "REGISTRATION_INCOMPLETE", errors, warnings }; a second submit, or one of a registration the provider
|
|
89
|
+
# already holds, gets a 409. Returns the registration, now SIGNAL_HOUSE_REVIEW or SUBMITTING.
|
|
90
|
+
def submit_registration(registration_id:, **opts)
|
|
91
|
+
@client.require_params("registrationId" => registration_id)
|
|
92
|
+
safe_id = CGI.escape(registration_id.to_s)
|
|
93
|
+
@client.request("/registration/#{safe_id}/submit", method: :post, token: opts[:token], headers: HttpClient.headers_for(opts))
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# POST /registration/:registrationId/launch
|
|
97
|
+
# Request the launch of a registration the provider already holds (an RCS agent in testing): the launch requirements
|
|
98
|
+
# are checked and the registration goes to SIGNAL_HOUSE_REVIEW, whose approval files the provider's launch request.
|
|
99
|
+
# Allowed while the provider reports the agent ready for testing, after a Signal House rejection, or after every
|
|
100
|
+
# carrier refused an earlier launch (409 otherwise); a failed requirement is a 400 whose details carry
|
|
101
|
+
# { code: "REGISTRATION_INCOMPLETE", errors, warnings }. Returns the registration, now SIGNAL_HOUSE_REVIEW.
|
|
102
|
+
def launch_registration(registration_id:, **opts)
|
|
103
|
+
@client.require_params("registrationId" => registration_id)
|
|
104
|
+
safe_id = CGI.escape(registration_id.to_s)
|
|
105
|
+
@client.request("/registration/#{safe_id}/launch", method: :post, token: opts[:token], headers: HttpClient.headers_for(opts))
|
|
106
|
+
end
|
|
107
|
+
|
|
64
108
|
# DELETE /registration/:registrationId
|
|
65
109
|
# Cancel a registration. Allowed from SIGNAL_HOUSE_REVIEW, SIGNAL_HOUSE_APPROVED, PENDING_PROVIDER,
|
|
66
|
-
# NEEDS_INFORMATION, PAYMENT_REQUIRED and APPROVED (409 otherwise)
|
|
67
|
-
# and stop sending.
|
|
110
|
+
# NEEDS_INFORMATION, PAYMENT_REQUIRED and APPROVED (409 otherwise), and for types that keep drafts also from DRAFT
|
|
111
|
+
# and SIGNAL_HOUSE_REJECTED. Numbers already allocated stay on the account and stop sending.
|
|
68
112
|
def cancel_registration(registration_id:, **opts)
|
|
69
113
|
@client.require_params("registrationId" => registration_id)
|
|
70
114
|
safe_id = CGI.escape(registration_id.to_s)
|
|
@@ -54,7 +54,7 @@ module SignalHouseSms
|
|
|
54
54
|
|
|
55
55
|
# POST /template
|
|
56
56
|
# Create a template whose first draft (version 1) holds body, the raw template body (e.g. an RcsTemplateBody
|
|
57
|
-
# { channel, contentFormat, content, variables, defaults, fallback }).
|
|
57
|
+
# { channel, contentFormat (optional; "content.v1" by default, or "google.rcs"), content, variables, defaults, fallback }).
|
|
58
58
|
# Returns 201 with { head, version }.
|
|
59
59
|
def create(group_id:, name:, body:, tag: nil, **opts)
|
|
60
60
|
@client.require_params("groupId" => group_id, "name" => name, "body" => body)
|
|
@@ -143,6 +143,16 @@ module SignalHouseSms
|
|
|
143
143
|
@client.request("/template/capabilities#{qs}", method: :get, token: opts[:token], headers: HttpClient.headers_for(opts))
|
|
144
144
|
end
|
|
145
145
|
|
|
146
|
+
# GET /template/geocode?groupId=...&address=...
|
|
147
|
+
# Resolves an address to coordinates for a VIEW_LOCATION suggestion. Returns { address, latitude, longitude,
|
|
148
|
+
# partialMatch }; 400 LOCATION_NOT_FOUND when nothing matches, 429 past the group's lookup window, 503 when the
|
|
149
|
+
# server has no geocoding provider.
|
|
150
|
+
def geocode_address(group_id:, address:, **opts)
|
|
151
|
+
@client.require_params("groupId" => group_id, "address" => address)
|
|
152
|
+
qs = @client.get_query_string(groupId: group_id, address: address)
|
|
153
|
+
@client.request("/template/geocode#{qs}", method: :get, token: opts[:token], headers: HttpClient.headers_for(opts))
|
|
154
|
+
end
|
|
155
|
+
|
|
146
156
|
# POST /template/media (multipart: file, groupId)
|
|
147
157
|
# file is an IO or a { filename:, io:, content_type: } hash; file_name names an IO part. Returns 201 with
|
|
148
158
|
# { mediaId, groupId, url, bytes, mimeType, kind, width, height, createdAt }.
|
data/lib/signalhouse_sms.rb
CHANGED
|
@@ -17,6 +17,7 @@ require_relative "signalhouse_sms/domains/notifications"
|
|
|
17
17
|
require_relative "signalhouse_sms/domains/numbers"
|
|
18
18
|
require_relative "signalhouse_sms/domains/registrations"
|
|
19
19
|
require_relative "signalhouse_sms/domains/onboarding"
|
|
20
|
+
require_relative "signalhouse_sms/domains/rcs"
|
|
20
21
|
require_relative "signalhouse_sms/domains/shortlinks"
|
|
21
22
|
require_relative "signalhouse_sms/domains/subgroups"
|
|
22
23
|
require_relative "signalhouse_sms/domains/subscriptions"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: signalhouse-sms
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- SignalHouse LLC
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-11-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Official Ruby SDK for the SignalHouse API. Provides a simple interface
|
|
14
14
|
for sending SMS/MMS messages, managing phone numbers, 10DLC brand/campaign registration,
|
|
@@ -34,6 +34,7 @@ files:
|
|
|
34
34
|
- lib/signalhouse_sms/domains/notifications.rb
|
|
35
35
|
- lib/signalhouse_sms/domains/numbers.rb
|
|
36
36
|
- lib/signalhouse_sms/domains/onboarding.rb
|
|
37
|
+
- lib/signalhouse_sms/domains/rcs.rb
|
|
37
38
|
- lib/signalhouse_sms/domains/registrations.rb
|
|
38
39
|
- lib/signalhouse_sms/domains/shortlinks.rb
|
|
39
40
|
- lib/signalhouse_sms/domains/subgroups.rb
|