Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yuki24/texting
SMS/MMS framework for Rails that doesn't hurt
https://github.com/yuki24/texting
actionmailer mms mms-framework rails ruby sms twilio
Last synced: about 1 month ago
JSON representation
SMS/MMS framework for Rails that doesn't hurt
- Host: GitHub
- URL: https://github.com/yuki24/texting
- Owner: yuki24
- License: mit
- Created: 2017-09-05T00:30:50.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-13T20:31:47.000Z (over 5 years ago)
- Last Synced: 2024-12-26T06:31:11.027Z (about 1 month ago)
- Topics: actionmailer, mms, mms-framework, rails, ruby, sms, twilio
- Language: Ruby
- Size: 44.9 KB
- Stars: 8
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Texting [![Build Status](https://travis-ci.org/yuki24/texting.svg?branch=master)](https://travis-ci.org/yuki24/texting)
Texting is a SMS/MMS framework that implements interfaces similar to ActionMailer.
* **Convention over Configuration**: Texting brings Convention over Configuration to your app for organizing your SMS/MMS implementations.
* **Extremely Easy to Learn**: If you know how to use ActionMailer, you already know how to use Texting. Send text messages asynchronously with ActiveJob at no learning cost.
* **Testability**: First-class support for testing SMS/MMS messages. No more hassle writing custom code or stubs/mocks for your tests.**While this gem is actively maintained, it is still under heavy development.**
## Getting Started
Add this line to your application's Gemfile:
```ruby
gem 'texting'
```### Supported Providers
Texxting itself doesn't send text messages. Instead, it uses an adapter to actually send them. As of writing, Texting only have support for Twilio and AWS SNS:
```ruby
# Use Twilio:
gem 'twilio-ruby'# Use AWS SNS:
gem 'aws-sdk-sns'
```Support for more providers will be added in the future.
### Writing your first messenger:
```ruby
# app/messengers/tweet_messenger.rb
class TweetMessenger < ApplicationMessenger
def new_direct_message(message_id, user_id)
message = DirectMessage.find(message_id)
user = User.find(user_id)text to: user.phone_number, body: <<~BODY.strip
Your follower #{user.name} juts sent you a direct message:#{message.body}
BODY
end
end
```### Deliver the text messages:
```ruby
TweetMessenger.new_direct_message(message_id, user.id).deliver_now!
# => sends a text message immediatelyTweetMessenger.new_direct_message(message_id, user.id).deliver_later!
# => enqueues a job that sends a text message later
```## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).