🏮Ruby
Enveloop provides the Enveloop Ruby wrapper for our Enveloop API. It simplifies configuring and sending messages (email & SMS/text) via Enveloop inside your Ruby apps.
Installing the Enveloop Ruby Gem
There are a couple of ways to get started. Using RubyGems, you can install it locally with the following command:
Additionally, you can add the following to your application's Gemfile:
After doing so, you can run the following terminal command:
Using the Enveloop Gem
The Enveloop Gem includes helpful methods to interact with the Enveloop API, including:
send_message
template_info
We'll talk about how to use some of these methods in the notes to follow.
Setting up a Connection
First, let's set up a connection. You'll need to require the enveloop
gem, define a client, and add in your Enveloop API token. Your API token is located in the Settings for each project you have on Enveloop.
Now that your connection is established, let's use a method to send a message.
(Note: This method call assumes that you have created a basic template in Enveloop and provides an example of a template variable you may use. Please alter according to how you have set up your template.)
Send an email message using an Enveloop Template
Send an email message using custom HTML
If you want to send a message, via Enveloop, and not use an Enveloop template, you can remove the template
argument from the method and include the html
argument instead (it takes a custom HTML body and creates a structured email message to send out).
Send a text/SMS message using an Enveloop Template
Along with email messages, you can also send text/SMS messages via Enveloop. In this example, the registration-complete
template is an SMS template. Therefore, Enveloop can accept mobile numbers for to/from.
Get information about an Enveloop template (variables, body HTML)
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/enveloophq/enveloop-ruby. Additional information, including license, development procedures, and Code of Conduct are available in the source repository documentation.
Last updated