Scale Your Marketing

How to Send a Dynamic Personalized Welcome Image to Each New User

Jon Yongfook · December 2020


Don't send the same boring email to everyone! Here's how to create some easy personalized content for your SaaS welcome emails.

If you sign up for Bannerbear you get a welcome email with an image like this:

The image has a few elements that are unique to each user including:

  • Today's date
  • User name
  • User photo

This image is generated automatically when a user opens the welcome email.

Why send a Welcome Email?

For a SaaS company or other B2B company, a welcome email is a great opportunity to:

  • Let the user know who they can contact for support
  • Point the user to the first step they need to take
  • Provide additional links and documentation for the user to explore
  • Say something about who you are as a brand!

Make it memorable!

To achieve all of the above, personalization is not required of course. But personalization does make the email more memorable, and in today's competitive world anything you can do to make your experiences more memorable is something you should invest in.

How to send a Welcome Email

The actual process of sending a welcome email is quite easy but it will depend entirely on what app framework you are using.

At Bannerbear we use Ruby on Rails which has a callback interface which triggers actions on events that you specify.

Many other frameworks will have a similar feature, so you will need to apply this methodology to the framework you are using.

In Rails, we can trigger an action on our user model whenever a new User is created with code like this:

class User < ApplicationRecord
  after_commit :send_welcome_email, :on => :create
  def send_welcome_email
    #send email!

That's the basics of sending a welcome email when a user signs up… so how do we create a dynamic image for each user?

Creating dynamic images with Bannerbear

Creating a dynamic, personalized image to insert in this welcome email is quite a simple process.

With the Signed URL feature of Bannerbear you can generate a unique, secure image URL to insert into your email. Then when the user opens the email, the URL is pinged by the browser and Bannerbear generates the image on the fly. Image generation speed depends on the complexity of the image but you can expect around 3 seconds to generate and display the image synchronously.

The principle of generating dynamic images is simple. You set up a template design in Bannerbear, and the template gives you an API to use.

Here's some example code of what it looks like to generate a "Hello (name)" image from a simple template in Bannerbear:

class User < ApplicationRecord

  def welcome_image_url
    #get this from Bannerbear
    base = ""

    #modifications: grab this JSON from your template API Console and modify as needed
    modifications = [{"name":"message","text":"Hello #{}"}]

    #create the query string
    query = "?modifications=" + Base64.urlsafe_encode64(modifications.to_json, :padding => false)

    #calculate the signature
    signature = OpenSSL::HMAC.hexdigest("SHA256", api_key, base + query)

    #Signed URL
    return base + query + "&s=" + signature


The final email template

Once you have understood the principles of creating dynamic images using Bannerbear Signed URLs it is then very easy to put this into practice.

We send our email from the User model on signup:

class User < ApplicationRecord
  after_commit :send_welcome_email, :on => :create
  def send_welcome_email

In ApplicationMailer we create the User instance:

class ApplicationMailer < ActionMailer::Base
  def user_welcome_email(id)
    @user = User.find(user_id)
    mail(to:, subject: "Welcome to Bannerbear")

And then finally in the email template we include the dynamic signed url for that User:

<img src="<%= @user.welcome_image_url %>" />

Signed URL documentation

Further reading and examples about Bannerbear's dynamic Signed URL images can be found at:

Bannerbear Signed URL Documentation

Node Examples

PHP Examples

Ruby Examples

There is also a more traditional REST API if you prefer to use that!

Tags for this article

Jon Yongfook@yongfook

Jon is the founder of Bannerbear. He has worked as a designer and programmer for 20 years and is fascinated by the role of technology in design automation.

Follow the Journey

Hello I'm Jon, the founder of Bannerbear — every 2 weeks I send a newsletter with updates from the Product, Marketing and Business sides of my startup, subscribe below to receive it!