Send Transactional Emails

A great path to start using OneSignal Email Messaging is to begin delivering transactional emails like:

  • Welcome emails,
  • Purchase confirmations,
  • Password resets, or
  • any other service-related message.

By sending transactional messages on OneSignal. You can easily track delivery, click, and open statistics on your transactional emails from the OneSignal Dashboard, alongside your push notifications and marketing emails.

Keep all of your communications in one place. If you are just starting to send emails, setting up transactional messages in OneSignal means:

  • you'll have fewer email products to manage,
  • you can see all communications to your users in one place, and
  • you can create visual automation with Journeys that can include marketing and transactional messaging.

Transactional vs marketing

Transactional emails typically are emails as a result of an action that a user has taken. It is not necessary for transactional emails to contain an unsubscribe link because the message itself is considered necessary to the delivery of your organization's services.

Marketing messages are all other messages that are not required as part of the delivery of your services. You should make sure you have consent to send marketing messages and include an unsubscribe link in every email. Read more about Email Regulatory Compliance.

Sending Transactional Emails

To send a transactional email, toggle open Advanced Settings and then click Include sending to unsubscribed users on either the Email Template or Email Campaign Message.

Sending to unsubscribed users means that you can remove the unsubscribe link from the message body. Messages that have the "Send to unsubscribed users" setting active, will be sent to every recipient in the segment regardless of their subscription status.

πŸ“˜

Clear unsubscribes from your suppression list

If you send via a third-party ESP like Mandrill, Mailgun, or SendGrid, you might need to clear unsubscribed emails from your suppression list to enable sending to those recipients and improve your deliverability.

When sending a transactional message via the OneSignal API. Set include_unsubscribed to true.

params = {
  "app_id" => "5eb5a37e-b458-11e3-ac11-000c2940e62c",
  "template_id" => "e59b3a5e-ccc4-44ff-b39e-aa4c668fe6c1",
  "include_player_ids" => ["6392d91a-b206-4b7b-a620-cd68e32c3a76"],
  "include_unsubscribed": true,
  "email_subject" => "Your Email Subject"
}
uri = URI.parse('https://onesignal.com/api/v1/notifications')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri.path,
                              'Content-Type'  => 'application/json;charset=utf-8',
                              'Authorization' => "Basic NGEwMGZmMjItY2NkNy0xMWUzLTk5ZDUtMDAwYzI5NDBlNjJj")
request.body = params.as_json.to_json
response = http.request(request) 
puts response.body
{
  "app_id": "YOUR_ONESIGNAL_APP_ID",
  "include_player_ids": ["6392d91a-b206-4b7b-a620-cd68e32c3a76"],
  "email_subject": "Your Email Subject",
  "template_id": "e59b3a5e-ccc4-44ff-b39e-aa4c668fe6c1",
  "include_unsubscribed": true,
}

🚧

Only exclude unsubscribe links for transactional emails

Make sure to include an unsubscribe link in all marketing emails to comply with Email Regulatory Compliance.

Create new transactional email templates

OneSignal supports the ability to create email Templates in the OneSignal Dashboard that you can use to send personalized transactional emails. This will give you greater visibility and control over your transactional emails for several reasons:

  • Templates can be easily modified directly from the OneSignal Dashboard, so you won't have to edit code each time you want to make a change.
  • You can use templates for journeys or send them via the API.
  • Just like push templates, you can get aggregate statistics on email templates.

Make sure to select Send to unsubscribed users when saving a template that is meant to be sent transactionally.

Read more about our Templates.

Migrate your existing transactional emails

Ideally, you would import all transactional email templates into OneSignal. But if that is not feasible, you have the option send your existing emails through the OneSignal API. Most backends (e.g. rails, node) use some form of basic emailer service that you can swap out for delivery through the OneSignal API with the email content provided as the message body.