Skip to main content

Invitations

Twinit sends out email notifications any time you invite a user to join a user group in your project or workspace. It will also send out a reminder if an invite has not been accepted and is getting close to expiring.

Default html templates are provided for your application when it is provisioned, but you will most likely want to customize your templates to include your own branding, your own messages, and information specific to your application.

Understanding the Invite Template#

The easiest way to access your notification templates is by using the Twinit console.

You can access the Twinit Sandbox Console by going to this url: https://sandbox.invicara.com/console or if you are managing your application on Twinit Production use this url: https://apps.invicara.com/console

The Twinit console makes managing and viewing your application settings easy.

View Your Application's Invite HTML Template#

  1. Go to https://sandbox.invicara.com/console
  2. Sign in as the application owner
  3. Select the Passport Service nav menu item

console passport service

  1. Select the Notification Templates tab

notification templates

  1. Find the USER_GROUP_INVITE template, click the menu on the right and select Edit

notification templates 2

  1. A dialog will open with the html email template

template html

Template Parameters#

Take a look through the html of the email template. As you do so, you'll notice parameters enclosed in ${ }. These will be replaced by the notification service with the values you provide when you send the invite ( like ${body_content} ) or that will be provided by the notification service ( like ${invite_link} ).

In the current email template these are the parameters you provide when sending the invite:

  • ${subject} - the subject of the email
  • ${host} - the root of a url to a logo file at ${host}/et/logo.png // this is usually a Twinit logo. You will most likely change the entire src property on line 50 though, as you will see below
  • ${body_header} - the header text of the email body
  • ${name} - usually the project or user group the user is being invited to, but can be anything...
  • ${body_content} - the main text of the email

The ${invite_link} will be provided by the Notification Service with the user's specific invitation id. However, when sending the invite you must send a ${base_url} parameter that matches one of the redirect urls for your application. The ${base_url} will be used to construct the ${invite_link}.

Notice that the ${subject} parameter is also used in the configuration of the template to use as the email subject.

console app subject

Other than ${base_url} none of the default template's parameters must be used. You are welcome to completely rewrite the template and use any parameters you wish.

Modifying the Invitation Template#

To see what our email currently looks like before we make any changes click the Page Preview link in the top right corner of the email template editor.

template preview

You will see a preview of what your email will look like when sent. Since we don't have values for any of the parameters they simply display as they do in the template. Notice the image also doesn't display, because the ${host} parameter used to point to the logo is not set.

Click Stop Preview to go back to the html template editor.

template preview 2

Modify the src of the image#

The first thing we will do is modify the url to the image in our template.

  1. Find the <img> tag on line 50 of the template
  2. Change the src prop value from "${host}/et/logo.png" to "https://lib.invicara.io/academy/dev-adv-logo.jpg"
  3. Click the Page Preview link again and you should see the image update to the title image of this course

template preview 3

Add a New Parameter#

Let's add a new section with a new parameter to the template.

  1. Copy lines 58, 59, and 60 and paste the three lines directly below starting on line 61
  2. Change the copied instance of ${body_content} to ${body_content_sub}

template preview 4

  1. Check the Page Preview again and notice the new parameter

template preview 5

Change the Button Text#

  1. Find line 67 of the html and scroll to the right until you see the 'Join Now' text
  2. Replace 'Join Now' with 'Accept Invite'

template preview 6

  1. Preview the page to see your change

template preview 7

  1. Click 'Save & Close'

Your changes have now been saved to your template and any future invites will use your modifications.

Send a Test Invitation#

  1. Download ADV03 - Send Invite.zip and extract and open the script in your IDE
  2. Follow the steps in the file