Emails (BETA)
Use this endpoint to send one-off emails to your subscribers. These emails will go into a priority queue for lightning fast delivery. Abuse of this endpoint will result in an instant account ban.
post
https://app.bentonow.com
/api/v1/batch/emails
Batch Import
Below is a short example in Ruby on how you may want to utilize this endpoint to send a few emails.
batch_importer.rb
# Find these under your account settings.
publishable_key = "XXXX-XXXX-XXXX-XXXX"
secret_key = "XXXX-XXXX-XXXX-XXXX"
# Find this under you site settings.
site_uuid = "XXXX-XXXX-XXXX-XXXX"
# You can send an array of emails.
# MAX 100 per request.
import_data = [
{
to: "[email protected]", # required — if no user with this email exists in your account they will be created.
from: "[email protected]", # required — must be an email author in your account.
subject: "Reset Password", # required
html_body: "<p>Here is a link to reset your password ... {{ link }}</p>", # required - can also use text_body if you want to use our plain text theme.
transactional: true, # IMPORTANT — this bypasses the subscription status of a user. Abuse will lead to account shutdown.
personalizations: {
link: "https://example.com/test"
} # optional — provide your own Liquid tags to be injected into the email.
},
]
uri = URI.parse("https://app.bentonow.com/api/v1/batch/emails")
request = Net::HTTP::Post.new(uri)
request.basic_auth(publishable_key, secret_key)
request.body = JSON.dump({site_uuid: site_uuid, emails: import_data })
request.content_type = "application/json"
req_options = { use_ssl: uri.scheme == "https", }
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(request)
end
puts JSON.parse(response.body)
Last modified 5mo ago