Example AvailableDirect HTTP API
Send SMS from Ruby on Rails with the SendiMessage API
Rails wraps the SendiMessage call in a plain service object, with credentials from Rails credentials or ENV. Enqueue it with ActiveJob so sends retry automatically and never block a request.
Webhooks arrive on a normal controller action — skip CSRF for that route, verify the signature, and update your records from the event payload.
What this integration enables
Order and status notifications
Trigger messages from Ruby on Rails when records change state.
Appointment reminders
Scheduled tasks that message customers before a booking.
Support updates
Notify customers as their request moves forward.
Reply handling
Receive incoming replies on a webhook route in the same codebase.
Architecture
- Your application eventAn order ships, a booking nears, a ticket updates
- Ruby on Rails server codeBuilds the request with credentials from the environment
- SendiMessage APIPOST /send-message returns the queued message
- Managed messaging lineSMS, or iMessage on supported lines and destinations
- Webhook eventsDelivery status and incoming replies post back to your endpoint
Example request
# app/services/sendi_message.rbclass SendiMessagedef self.send_message(to:, text:)uri = URI("https://api.sendimessage.com/v1/send-message")req = Net::HTTP::Post.new(uri, {"X-API-Key" => ENV.fetch("SENDIMESSAGE_KEY"),"X-API-Secret" => ENV.fetch("SENDIMESSAGE_SECRET"),"Content-Type" => "application/json",})req.body = { number: to, content: text }.to_jsonres = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |h| h.request(req) }raise "SendiMessage error #{res.code}: #{res.body}" unless res.is_a?(Net::HTTPSuccess)JSON.parse(res.body) # {"message_handle" => "4e828182-…", "status" => "QUEUED", …}endend# app/controllers/webhooks_controller.rbclass WebhooksController < ApplicationControllerskip_before_action :verify_authenticity_tokendef sendimessage# Verify the SendiMessage-Signature header: t={timestamp},v1=HMAC-SHA256("{timestamp}.{raw body}").event = JSON.parse(request.raw_post)head :okendend
Delivery events and incoming replies
Point a Ruby on Rails route at your webhook URL to receive delivery status and incoming replies. Verify the signature header before processing.
// "outbound" event → your rails endpoint// Verify the SendiMessage-Signature header (t={timestamp},v1=HMAC-SHA256 of// "{timestamp}.{raw body}", keyed with your webhook secret), then use// GET /v2/messages/{message_handle} for authoritative state and match it to// your contact_id in rails.
Limitations and honest notes
- iMessage delivery is available on supported messaging lines and destinations. Recipients without iMessage receive SMS when fallback is configured — never assume universal iMessage availability.
- Messages are accepted asynchronously — the API returns status QUEUED and final status arrives via webhook or the message endpoints.
- No official SDK for this ecosystem yet — the example uses plain HTTP against the REST API. Official SDKs are published for JavaScript/TypeScript (npm: sendimessage), Python (PyPI: sendimessage), PHP (Composer: sendimessage/sdk), and Go (github.com/sendimessage/sendimessage-go). Every SDK is dependency-free and covers the full public API surface.
Security considerations
- Keep the API key pair in server configuration or environment variables, never in the repository.
- Verify webhook signatures before trusting delivery or reply events.
Frequently asked questions
Is there an official Ruby on Rails package for SendiMessage?
Not a framework-specific one. SendiMessage is a plain REST API, so your framework's standard HTTP client is all that's required — the example on this page is complete. Official SDKs are published for JavaScript/TypeScript, Python, PHP, and Go.
Can Ruby on Rails receive message replies?
Yes. Add a route that accepts SendiMessage webhook POSTs; incoming replies arrive as receive events. Correlate them with your records via the message_handle and conversation data in the event.
Related integrations
RubyExample Available
LanguagesNet::HTTP example, standard library only.Customer Support MessagingAPI Integration Guide
Use CasesHelpdesk events out, customer replies back into the ticket.LaravelExample Available
FrameworksOfficial PHP SDK in a queued job — clean, retryable sends.Next.jsExample Available
FrameworksOfficial SDK in a route handler — key stays on the server.ReactExample Available
FrameworksBrowser-safe pattern: your UI calls your backend, never the API.ExpressExample Available
FrameworksOfficial SDK: send route + verified webhook route in one app.Ready to connect Ruby on Rails?
Request a messaging line and a SendiMessage integration specialist will review your Ruby on Rails workflow and guide the setup.