{"id":13880032,"url":"https://github.com/messagebird/ruby-rest-api","last_synced_at":"2025-07-16T16:30:42.152Z","repository":{"id":18490155,"uuid":"21685890","full_name":"messagebird/ruby-rest-api","owner":"messagebird","description":"MessageBird's REST API for Ruby","archived":false,"fork":false,"pushed_at":"2025-04-09T10:59:43.000Z","size":401,"stargazers_count":37,"open_issues_count":17,"forks_count":49,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-06-28T06:51:24.099Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/messagebird.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-07-10T08:12:23.000Z","updated_at":"2025-04-09T10:59:47.000Z","dependencies_parsed_at":"2024-06-02T22:14:49.890Z","dependency_job_id":"e9117a4d-150a-41cd-9a60-6e0d2545d89c","html_url":"https://github.com/messagebird/ruby-rest-api","commit_stats":{"total_commits":263,"total_committers":39,"mean_commits":6.743589743589744,"dds":0.7680608365019012,"last_synced_commit":"64bcb3f17decff8141821fb61b1bd39331095da1"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/messagebird/ruby-rest-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/messagebird%2Fruby-rest-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/messagebird%2Fruby-rest-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/messagebird%2Fruby-rest-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/messagebird%2Fruby-rest-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/messagebird","download_url":"https://codeload.github.com/messagebird/ruby-rest-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/messagebird%2Fruby-rest-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265524602,"owners_count":23782009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-06T08:02:44.366Z","updated_at":"2025-07-16T16:30:42.140Z","avatar_url":"https://github.com/messagebird.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"MessageBird's REST API for Ruby\n===============================\nThis repository contains the open source Ruby client for MessageBird's REST API. Documentation can be found at: https://developers.messagebird.com/\n\n[![Build Status](https://github.com/messagebird/ruby-rest-api/actions/workflows/test.yml/badge.svg)](https://github.com/messagebird/ruby-rest-api/actions)\n\nRequirements\n------------\n- [Sign up](https://dashboard.messagebird.com/app/en/sign-up) for a free MessageBird account\n- Create a new `access_key` in the developers sections\n- MessageBird's API client for Ruby requires Ruby \u003e= 1.9\n\nInstallation\n------------\nYou can either include the following line in your Gemfile:\n\n```ruby\ngem 'messagebird-rest', require: 'messagebird'\n```\n\nOr you can just manually install it from the command line:\n\n```sh\n$ gem install messagebird-rest\n```\n\nExamples\n--------\nWe have put some self-explanatory examples in the *examples* directory, but here is a quick breakdown on how it works. First, you need to create an instance of **MessageBird::Client**. Be sure to replace **YOUR_ACCESS_KEY** with something real in the bottom example.\n\n```ruby\nrequire 'pp' # Only needed for this example\nrequire 'messagebird'\n\nclient = MessageBird::Client.new(YOUR_ACCESS_KEY)\n```\n\nThat's easy enough. Now we can query the server for information.\n\n##### Balance\nLets start with out with an overview of our balance.\n\n```ruby\npp client.balance\n\n#\u003cMessageBird::Balance:0x007f8d5c83f478\n @amount=9,\n @payment=\"prepaid\",\n @type=\"credits\"\u003e\n```\n\n##### Messages\nChances are that the most common use you'll have for this API client is the ability to send out text messages. For that purpose we have created the **message_create** method, which takes the required *originator*, one or more *recipients* and a *body* text for parameters.\n\nOptional parameters can be specified as a hash.\n\n```ruby\npp client.message_create('FromMe', '31612345678', 'Hello World', reference: 'MyReference')\n\n#\u003cMessageBird::Message:0x007f8d5b883520\n @body=\"Hello World\",\n @created_datetime=2014-07-07 12:20:30 +0200,\n @datacoding=\"plain\",\n @direction=\"mt\",\n @gateway=239,\n @href=\n  \"https://rest.messagebird.com/messages/211e6280453ba746e8eeff7b12582146\",\n @id=\"211e6280453ba746e8eeff7b12582146\",\n @mclass=1,\n @originator=\"FromMe\",\n @recipient=\n  {\"total_count\"=\u003e1,\n   \"totalSentCount\"=\u003e1,\n   \"totalDeliveredCount\"=\u003e0,\n   \"totalDeliveryFailedCount\"=\u003e0,\n   \"items\"=\u003e\n    [#\u003cMessageBird::Recipient:0x007f8d5c058c00\n      @recipient=31612345678,\n      @status=\"sent\",\n      @statusDatetime=2014-07-07 12:20:30 +0200\u003e]},\n @reference=\"MyReference\",\n @scheduled_datetime=nil,\n @type=\"sms\",\n @type_details={},\n @validity=nil\u003e\n```\n\nAs a possible follow-up, you can use the **message** method with the above mentioned batch-id to query the status of the message that you just created. It will return a similar Message object.\n\n```ruby\nclient.message('211e6280453ba746e8eeff7b12582146')\n```\n\n##### HLR\nTo perform HLR lookups we have created the **hlr_create** method, which takes a number and a reference for parameters.\n\n```ruby\npp client.hlr_create('31612345678', 'MyReference')\n\n#\u003cMessageBird::HLR:0x007f8d5b8dafc8\n @created_datetime=2014-07-07 12:20:05 +0200,\n @href=\"https://rest.messagebird.com/hlr/4933bed0453ba7455031712h16830892\",\n @id=\"4933bed0453ba7455031712h16830892\",\n @msisdn=31612345678,\n @network=nil,\n @reference=\"MyReference\",\n @status=\"sent\",\n @statusDatetime=2014-07-07 12:20:05 +0200\u003e\n```\n\nSimilar to the **message_create** and **message** methods, the **hlr_create** method has an accompanying **hlr** method to poll the HLR object.\n\n```ruby\nclient.hlr('4933bed0453ba7455031712h16830892')\n```\n\n##### Verify (One-Time Password)\nYou can send and verify One-Time Passwords through the MessageBird API using the **verify_create** and **verify_token** methods.\n\n```ruby\n# verify_create requires a recipient as a required parameter, and other optional paramaters\nclient.verify_create(31612345678, reference: \"YourReference\")\n\n#\u003cMessageBird::Verify:0x007fb3c18c8148\n @id=\"080b7f804555213678f14f6o24607735\",\n @recipient=\"31612345678\",\n @reference=\"YourReference\",\n @status=\"sent\",\n @href={\"message\"=\u003e\"https://rest.messagebird.com/messages/67d42f004555213679416f0b13254392\"},\n @created_datetime=2015-05-12 16:51:19 +0200,\n @validUntilDatetime=2015-05-12 16:51:49 +0200\u003e\n```\n\nThis sends a token to the recipient, which can be verified with the **verify_token** method.\n\n```ruby\n# verify_token requires the id of the verify request and a token as required parameters.\nclient.verify_token('080b7f804555213678f14f6o24607735', 123456)\n```\n\n##### Voice Message\nMessageBird also offers the ability to send out a text message as a voice message, or text-to-speech. For that purpose we have created the **voice_message_create** method, which takes one or more required *recipients* and a *body* text for parameters.\n\nOptional parameters can be specified as a hash.\n\n```ruby\npp client.voice_message_create('31612345678', 'Hello World', reference: 'MyReference')\n\n#\u003cMessageBird::VoiceMessage:0x000001030101b8\n @body=\"Hello World\",\n @created_datetime=2014-07-09 12:17:50 +0200,\n @href=\n  \"https://rest.messagebird.com/voicemessages/a08e51a0353bd16cea7f298a37405850\",\n @id=\"a08e51a0353bd16cea7f298a37405850\",\n @ifMachine=\"continue\",\n @language=\"en-gb\",\n @recipients=\n  {\"total_count\"=\u003e1,\n   \"totalSentCount\"=\u003e1,\n   \"totalDeliveredCount\"=\u003e0,\n   \"totalDeliveryFailedCount\"=\u003e0,\n   \"items\"=\u003e\n    [#\u003cMessageBird::Recipient:0x000001011d3178\n      @recipient=31612345678,\n      @status=\"calling\",\n      @statusDatetime=2014-07-09 12:17:50 +0200\u003e]},\n @reference=\"MyReference\",\n @repeat=1,\n @scheduledDatetime=nil,\n @voice=\"female\"\u003e\n```\n\nSimilar to regular messaging and HLR lookups, there is a method available to fetch the VoiceMessage object by using an *id*.\n\n```ruby\nclient.voice_message('a08e51a0353bd16cea7f298a37405850')\n```\n\n##### Numbers\nThere is also a Numbers API that allow you to search for and purchase number subscriptions to use as originator in other services.\n\n```ruby\npp client.number_search(\"NL\", limit: 52)\n\n#\u003cList:0x00007fa405130618\n @count=5,\n @items=\n  [#\u003cMessageBird::Number:0x00007fa405130528\n    @country=\"NL\",\n    @features=[\"voice\"],\n    @locality=\"Rotterdam\",\n    @number=\"31102005108\",\n    @region=\"\",\n    @type=\"unknown\"\u003e,\n   #\u003cMessageBird::Number:0x00007fa4051303c0\n    @country=\"NL\",\n    @features=[\"voice\"],\n    @locality=\"Rotterdam\",\n    @number=\"31102005143\",\n    @region=\"\",\n    @type=\"unknown\"\u003e,\n   #\u003cMessageBird::Number:0x00007fa405130208\n    @country=\"NL\",\n    @features=[\"voice\"],\n    @locality=\"Rotterdam\",\n    @number=\"31102005145\",\n    @region=\"\",\n    @type=\"unknown\"\u003e,\n   #\u003cMessageBird::Number:0x00007fa4051300c8\n    @country=\"NL\",\n    @features=[\"voice\"],\n    @locality=\"Rotterdam\",\n    @number=\"31102005147\",\n    @region=\"\",\n    @type=\"unknown\"\u003e,\n   #\u003cMessageBird::Number:0x00007fa405131c48\n    @country=\"NL\",\n    @features=[\"voice\"],\n    @locality=\"Rotterdam\",\n    @number=\"31102005148\",\n    @region=\"\",\n    @type=\"unknown\"\u003e],\n @limit=5,\n @type=MessageBird::Number\u003e\n````\n\nDocumentation\n-------------\nComplete documentation, instructions, and examples are available at:\n[https://developers.messagebird.com/](https://developers.messagebird.com/).\n\nReleasing this gem \n------------------\n[RELEASE.md](./RELEASE.md).\n\nLicense\n-------\nThe MessageBird REST Client for Ruby is licensed under [The BSD 2-Clause License](http://opensource.org/licenses/BSD-2-Clause). Copyright (c) 2025, MessageBird\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmessagebird%2Fruby-rest-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmessagebird%2Fruby-rest-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmessagebird%2Fruby-rest-api/lists"}