Ruby Library v2

View Repo

The Flowroute Ruby Library v2 provides methods for interacting with Messages v2 of the Flowroute API.



  1. First, start a shell session and clone the SDK:

    via HTTPS:

    git clone

    via SSH:
  2. Switch to the newly-created flowroute-messaging-ruby directory and run the following to build the Flowroute gem:

    gem build flowroute_messaging.gemspec

    This version of the library has been tested with Ruby 2.5.0 for Mac OS X. To see which version of ruby is installed on your machine, run the following:

    ruby --version
  3. Once built, run the following to install the gem in the current directory:

    gem install flowroute_messaging-1.0.gem


In Flowroute's approach to building the Messaging (v2) API wrapper, HTTP requests are handled by the APIController, which contains the functions used to perform tasks with the Ruby SDK.


The following shows how you can import and instantiate the APIController:

#Require Flowroute Messaging
require 'flowroute_messaging'

#Pass your API credentials



In your Ruby file, replace accessKey:secretKey with your API credentials from the Flowroute Manager.

#Pass your API credentials




The method accepts the msg, to, from, and body parameters which you can learn more about in the API reference.

#Create and send the message
msg ='15305557784', from='18444205700', content='You're obviously not a golfer.')
print ctl.create_message(msg)

Example Response
"data": {
    "id": "mdr1-fab29a740129404a8ca794efc1359e12'


The method accepts the record_id parameter which you can learn more about in the API reference.

#Get the MDR
recID = 'fab29a740129404a8ca794efc1359e12'
print ctl.get_message_lookup(recID)

Example Response
"data": {
  "attributes": {
      "body": "Gee, nice marmot!",
      "direction": "outbound",
      "amount_nanodollars": 4000000,
      "message_encoding": 0,
      "timestamp": "2016-05-03T17:41:00.478893+00:00",
      "has_mms": false,
      "to": "15305557784",
      "amount_display": "$0.0040",
      "from": "18444205700",
      "callback_url": None,
      "message_type": "long-code"
  "type": "message",
  "id": "mdr1-cfab29a740129404a8ca794efc1359e12"


©2004 - 2022 BCM One. All right reserved. Legal | Privacy Policy | Blog | News | Contact