Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pdabrowski6/office_boy
Wrapper for Sendgrid API
https://github.com/pdabrowski6/office_boy
Last synced: 7 days ago
JSON representation
Wrapper for Sendgrid API
- Host: GitHub
- URL: https://github.com/pdabrowski6/office_boy
- Owner: pdabrowski6
- License: mit
- Created: 2019-11-10T16:45:55.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-11-08T21:32:20.000Z (about 3 years ago)
- Last Synced: 2024-10-31T13:52:43.557Z (15 days ago)
- Language: Ruby
- Size: 13.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Office Boy
Start with creating `config/initializers/office_boy.rb` initializer:
```ruby
OfficeBoy.configure do |config|
config.sendgrid_api_key = 'api_key'# Contact lists
config.lists = {
blog_subscribers: '38bbd55-4ac9-31'
}# Transactional templates
config.templates = {
welcome_subscriber: 'd-6955c2836821d0'
}
end
```## Adding subscribers
```ruby
contact_attributes = {
'first_name' => 'John',
'last_name' => 'Doe',
'email' => '[email protected]'
}OfficeBoy.add_subscriber(
list: :blog_subscribers,
attributes: contact_attributes
)
```## Removing subscribers
```ruby
OfficeBoy.remove_subscriber(
list: :blog_subscribers,
email: '[email protected]'
)
```## Sending e-mails
```ruby
OfficeBoy.deliver(
template: :welcome_subscriber,
attributes: {
from_email: 'your email',
from_name: 'your name',
to_email: '[email protected]',
to_name: 'John Doe',
subject: 'Welcome on my list!',
dynamic_template_data: {
first_name: 'John'
}
}
)
```