SignalHouse Ruby SDK
Official Ruby SDK for the SignalHouse SMS/MMS messaging API.
Full API reference and guides: https://app2.signalhouse.io/docs
Installation
Add to your Gemfile:
gem "signalhouse-sms"Then run:
bundle installOr install directly:
gem install signalhouse-smsQuick Start
Initialize the Client
require "signalhouse_sms"
client = SignalHouseSms::Client.new(
api_key: "your-api-key",
base_url: "https://v2.signalhouse.io"
)For admin operations (SignalHouse internal staff):
client = SignalHouseSms::Client.new(
api_key: "your-api-key",
base_url: "https://v2.signalhouse.io",
enable_admin: true
)Login
result = client.auth.login(email: "user@example.com", password: "password123")
if result["success"]
token = result["data"]["token"]
puts "Logged in! Token: #{token}"
else
puts "Login failed: #{result["error"]}"
endSend an SMS
result = client.messages.send_sms(
sender_phone_number: "15551234567",
recipient_phone_numbers: ["15559876543"],
message_body: "Hello from SignalHouse!",
token: "your-jwt-token"
)
puts resultSend an MMS with Images
image_file = {
filename: "photo.jpg",
io: File.open("photo.jpg", "rb"),
content_type: "image/jpeg"
}
result = client.messages.send_mms(
sender_phone_number: "15551234567",
recipient_phone_numbers: ["15559876543"],
message_body: "Check out this photo!",
images: [image_file],
token: "your-jwt-token"
)
puts resultList Phone Numbers
result = client.numbers.get_phone_numbers(
group_id: "G0000001",
page: 1,
limit: 20,
token: "your-jwt-token"
)
if result["success"]
result["data"]["data"].each do |number|
puts number["phoneNumber"]
end
endPurchase Phone Numbers
result = client.numbers.purchase_phone_number(
phone_numbers: ["15551234567"],
subgroup_id: "SG000001",
token: "your-jwt-token"
)
puts resultCreate a Brand
result = client.brands.create_brand(
brand_data: {
subgroupId: "SG000001",
entityType: "PRIVATE_PROFIT",
displayName: "My Brand",
companyName: "My Company Inc",
ein: "123456789",
phone: "15551234567",
street: "123 Main St",
city: "New York",
state: "NY",
postalCode: "10001",
country: "US",
email: "contact@mycompany.com",
vertical: "TECHNOLOGY"
},
token: "your-jwt-token"
)
puts resultCreate a Toll-Free Brand
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.
requirements = client.brands.get_toll_free_requirements(group_id: "G0000001", token: "your-jwt-token")
raise requirements["error"] unless requirements["success"]
toll_free = {
businessRegistrationType: "EIN",
legalEntityType: "PRIVATE_COMPANY",
taxId: "123456789",
countryCode: "US",
supportPhone: "15551234567"
}
if requirements["data"]["reviewsBusinessOnSubmit"]
toll_free.merge!(
businessStructure: "CORPORATION",
industry: "TECHNOLOGY",
contactEmail: "jane@mycompany.com",
contactJobTitle: "Operations Manager",
contactJobLevel: "DIRECTOR"
)
end
result = client.brands.create_toll_free_brand(
brand_data: {
subgroupId: "SG000001",
displayName: "My Brand",
companyName: "My Company Inc",
street: "123 Main St",
city: "New York",
state: "NY",
postalCode: "10001",
email: "contact@mycompany.com",
firstName: "Jane",
lastName: "Doe",
website: "https://mycompany.com",
tollFree: toll_free
},
token: "your-jwt-token"
)
puts resultUsing Token Override
All methods accept a token: keyword to override the API key for that specific request. This is useful when making requests on behalf of authenticated users:
# Use the client's api_key (default)
result = client.brands.get_brands
# Override with a specific user token
result = client.brands.get_brands(token: "user-jwt-token")Custom Headers
All methods accept a headers: keyword to add custom headers:
result = client.brands.get_brands(
token: "user-jwt-token",
headers: { "X-Request-Id" => "abc123" }
)Admin Methods
When enable_admin: true is set, admin-scoped methods are available on domains that support them:
client = SignalHouseSms::Client.new(
api_key: "admin-api-key",
base_url: "https://v2.signalhouse.io",
enable_admin: true
)
# Admin: list all groups
client.groups.admin.get_groups(page: 1, limit: 50, token: admin_token)
# Admin: approve a campaign
client.campaigns.admin.approve_campaign(campaign_id: "C123", token: admin_token)
# Admin: create subscription template
client.subscriptions.admin.create_template(
template_data: { templateName: "Pro Plan", monthlyFee: 50_000_000 },
token: admin_token
)
# Admin: create internal user
client.users.admin.create_internal_user(
data: { email: "admin@signalhouse.io", role: "signalhouse_admin" },
token: admin_token
)Available Domains
| Domain | Accessor | Methods |
|---|---|---|
| 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
|
| 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
|
| 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, get_caller_name, set_caller_name, delete_caller_name (get_brands takes search:, one term or an Array of terms that must all match) |
| Campaigns | client.campaigns |
get_campaigns, create_campaign, update_campaign, delete_campaign (get_campaigns takes search:, one term or an Array of terms that must all match) |
| Campaigns Admin | client.campaigns.admin |
approve_campaign, reject_campaign
|
| Compliance | client.compliance |
get_cases, get_case, answer_requirement, upload_file, get_file (Signal House opens, works and closes cases; you answer their requirements) |
| Groups | client.groups |
get_group, update_group, get_sso_configuration, save_sso_connection, delete_sso_connection, get_ontraport_connection, connect_ontraport, disconnect_ontraport, regenerate_ontraport_webhook_token, add_sso_domain, verify_sso_domain, remove_sso_domain
|
| Groups Admin | client.groups.admin |
get_groups, create_group, delete_group
|
| Landings | client.landings |
get_landings, get_public_landing, create_landing, update_landing, get_landing_by_brand_id, delete_landing
|
| Messages | client.messages |
get_messages, get_analytics, send_sms, send_mms, send_group_message, get_p2p_batch (deprecated: P2P is retired and answers 410) |
| Notifications | client.notifications |
get_notifications, update_notification_status, delete_notification
|
| Numbers | client.numbers |
get_phone_numbers, get_number_health, get_available_phone_numbers, purchase_phone_number, update_phone_number, get_caller_name, set_caller_name, delete_caller_name, port_in_phone_number, assign_phone_number_to_campaign, unassign_phone_numbers_from_campaigns, delete_phone_numbers, transfer_phone_numbers, search_npa_nxx, lookup_locations (get_phone_numbers takes search:, one term or an Array of terms that must all match) |
| Shortlinks | client.shortlinks |
get_shortlink_redirect, get_shortlink
|
| Subgroups | client.subgroups |
get_subgroups, create_subgroup, update_subgroup, delete_subgroup (get_subgroups takes search:, one term or an Array of terms that must all match) |
| Subscriptions | client.subscriptions |
get_subscriptions, subscribe, unsubscribe
|
| Subscriptions Admin | client.subscriptions.admin |
get_templates, create_template, update_template, delete_template, create_custom_subscription
|
| Templates | client.templates |
create, list, get, update, publish, archive, versions, validate, capabilities, upload_media
|
| RCS Agents | client.rcs.agents |
create, list, get, update, validate, submit, archive, upload_asset
|
| RCS Messages | client.rcs.messages |
send, validate, estimate, capabilities, get, list
|
| Users | client.users |
get_users, create_user, create_service_user, update_user, delete_user, get_notification_preferences, update_notification_preferences
|
| Users Admin | client.users.admin |
get_users, create_internal_user
|
| Verify | client.verify |
check_sim_swap, start_number_verification, get_number_verification (phone on mobile data for Number Verify; each answered check is billed) |
| Webhooks | client.webhooks |
get_webhooks, create_webhook, update_webhook, delete_webhook
|
Error Handling
begin
result = client.messages.send_sms(
sender_phone_number: "15551234567",
recipient_phone_numbers: ["15559876543"],
message_body: "Hello!"
)
rescue SignalHouseSms::ValidationError => e
puts "Validation error: #{e.message} (status: #{e.status})"
rescue SignalHouseSms::Error => e
puts "SignalHouse error: #{e.message} (status: #{e.status})"
endResponse Format
All methods return a standardized hash:
Success:
{
"success" => true,
"data" => { ... }, # Parsed JSON response body
"status" => 200 # HTTP status code
}Error:
{
"success" => false,
"error" => "Error message",
"status" => 400 # HTTP status code
}Requirements
- Ruby >= 3.0.0
- No external dependencies (uses
net/httpandjsonfrom stdlib)
License
MIT