How to send RCS messages with Ruby and Twilio
Time to read: 4 minutes
Rich Communication Services (RCS) is reshaping the way businesses and consumers interact, offering a modern messaging experience that combines the reliability of SMS with the interactive features of popular messaging apps. Apple devices also now support RCS, as of the release of iOS 18. Developers around the globe are exploring how to integrate this cutting-edge channel into their applications.
In this tutorial, we’ll show you how to get started with RCS using Twilio and Ruby.
Comparing RCS to SMS and WhatsApp
RCS is revolutionizing the messaging landscape by combining the simplicity of SMS with the advanced features of modern apps like WhatsApp. With multimedia, verified sender profiles, and comprehensive engagement tracking support, RCS offers a rich, interactive experience—all without requiring an additional app download. For a deeper dive into how RCS stacks up against other messaging channels, check out the Guide to Rich Communication Services: What Developers Need to Know.
Implementing RCS with Twilio and Ruby
Getting started with RCS to test message sending is easy with Twilio. We’ll walk you through creating an RCS sender, creating a messaging service, and sending your first RCS message using Ruby.
Prerequisites
To get started, you will need the following:
Step 1: Create an RCS Sender
- Log in to the Twilio Console.
- Navigate to the Explore Products section and click RCS. • If RCS isn’t visible, you may need to request access here.
3. In the side panel, navigate to the Senders section.
4. Click Create new sender.
Step 2: Add Profile Information
Next, you’ll add profile information for your RCS sender. Use the following:
- Sender display name: Choose a recognizable name for your sender. Usually, this is your brand name. For our example, we will use “My First RCS Sender”.
- Description: Describe your brand. This description will be displayed just under your display name at the top of your user’s RCS interactions.
- Border color: Keep in mind the minimum contrast ratio. For testing purposes, start with
#000000
to keep it simple. - Logo: Your brand logo should meet the following requirements:
• Dimensions: 224x224 pixels
• File size: Max 50 KB
• Image type: JPEG/JPG/PNG
• For testing, you can use this example image:https://corn-lobster-7338.twil.io/assets/twiliodevs-logo-rcs.png
- Banner: Your brand banner should meet the following requirements:
• Dimensions: 1440x448 pixels
• File size: Max 200KB
• Image type: JPEG/JPG/PNG
• For testing, you can use this example image:https://corn-lobster-7338.twil.io/assets/twiliodevs-banner-rcs.png
- Contact Details - Phone number: A phone number associated with your RCS sender is required. Optionally, you can also add an email address.
- Link to privacy policy and Link to terms of service: For testing purposes, you can enter links to arbitrary information here. When you begin building for production usage, make sure to create an RCS sender with real information about your business.
Step 3: Test Your RCS Sender
- On the optional Test tab, click Add device to test this sender.
2. Enter the phone number of your RCS-capable device and click Invite.
3. You should receive an opt-in message from Twilio’s RCS agent on your device.
4. Confirm the opt-in on your device by selecting Make me a tester.
5. Check the dialog box in the Twilio Console, and send a test message.
6. Celebrate—you’ve just sent your first RCS message!
Step 4: Create a Messaging Service
- In the Console, navigate to Messaging > Services.
- Click Create Messaging Service.
4. Add your RCS sender.
5. Click Add Sender, select RCS Sender.
Step 5: (Optional) Set Up Webhook Integration
- Webhooks allow you to handle incoming messages in the same way as SMS or WhatsApp. Learn more in Twilio's docs about Incoming Message Webhooks.
- Use the Set Up Integration option to register a webhook. Feel free to reuse an existing one if available.
Step 6: Send Your First RCS Message with Ruby
- Finish the wizard flow by clicking the white Skip setup button.
2. Copy the Messaging Service SID (like MGe1fdfb207e9aa5b44f398b1094d88a8b
) from the Console.
4. Create a file in your Ruby project folder called .env
. Add the credentials from the previous steps, so that your file looks like this:
6. Create a new file named sendRCS.rb
with the following code:
ruby sendRCS.rb
and see the result on your phone.Explore Advanced RCS Features
Congratulations! You just sent your first RCS message using Ruby!
Business messaging with RCS opens up a whole new world of possibilities. If you’re looking for the next steps, start by exploring some of the other things you can do with your new capabilities:
- Extend your script to use the Content Template Builder for rich message content.
- Explore the Programmable Messaging Logs to see message statuses and troubleshoot any errors.
- Learn how to send OTP codes with RCS. With Twilio Verify, it’s easy to deliver secure and engaging one-time passwords to your users.
Twilio is continuously enhancing its RCS offering with features like failover for undelivered messages and quick reply buttons. Stay tuned for updates, and start building more engaging customer experiences today!
RCS is redefining how businesses connect with customers—combining the reliability of SMS with the interactivity of modern messaging apps. With Twilio, you can harness RCS to elevate your messaging strategy.
We can’t wait to see what you build!
Related Posts
Related Resources
Twilio Docs
From APIs to SDKs to sample apps
API reference documentation, SDKs, helper libraries, quickstarts, and tutorials for your language and platform.
Resource Center
The latest ebooks, industry reports, and webinars
Learn from customer engagement experts to improve your own communication.
Ahoy
Twilio's developer community hub
Best practices, code samples, and inspiration to build communications and digital engagement experiences.