Scenarios for webinar and event reminders
In this tutorial, let's look at two basic scenarios for automating webinar mailings:
- simple - with one email;
- advanced - with several emails, including checking contact's registration time to ensure that each email is sent in a timely and correct manner.
Sending one email before the webinar starts
Let's consider the simplest option - sending one reminder email a certain time before the webinar starts. The scenario would look like this:
Step 1. The scenario will start with an API request block (Starting Blocks → API) - this request should be sent to enKod from the website when the user registers for the webinar. The request will contain scenario fields, which will pass the necessary information about the event. The request body usually looks like this:
{ "email": "[email protected]", "scenarioFields": { "name": "Webinar's name", "date_webinar": "Date corresponding to the format from the documentation" } }
- Transmit contact ID - email (or phone if you want to send SMS);
Important! The contact must be in the enKod contact database.
- In the name parameter (you can give it another name as you like) the name of the webinar is passed in order to display it in the email. You can add any other required parameters (e.g. speaker, webinar link, etc.) in the same way;
- In the date_webinar (can be named by any other name you like) you need to pass the start date of the webinar;
All parameters must be created in advance inside the scenario wizard (as scenario fields) and assigned the appropriate data type to them. These changes are made in the section Mailings → Scenarios → Scenario Wizard → Scenario Fields
Step 2. Add a main «Pause» block, where the contact will stay until a certain time (for example, until there is 1 hour left before the webinar).
If you pass in the webinar date field past date then the contact will instantly pass the pause block and move on to sending the email.
• If you do not register users for the webinar after it has started, this will not happen.
• If this is possible in your case, you can use the method abort() in the message code to prevent such an email from being sent: to do this, you need to additionally pass in your API-request the date of the user registration for the webinar and compare it with the date of the webinar - if it is later than that, then abort() the email.
Step 3. In this step, you need to send an email to the contact:
- you can do it using the «Sending message» block. In this case, the contact should be previously subscribed to at least one mailing group of the selected channel
- an alternative option is the «API request» block if you need to send a transactional email. This requires creating this letter in the platform and passing scenario fields as snippets in the API-request.
In the sent email you will need to configure dynamic content, so that the scenario fields are inserted into the message body.
Step 4. The final step is the «Finish» block or you can configure a continuation if needed.
For example, if you have webinars, after which you need to send an email to the user with the subject «How did you like the webinar?». Then you can add a boolean field to the original API-request isAskAfter
where you can pass true
if you need to send this letter, and make the distribution to the branch with the sending of this letter (with the help of the main block «Distribution»).
Sending two or more emails before the webinar starts
The concept remains the same, only now you need to send 3 emails before the webinar starts:
- the first one - 24 hours in advance,
- the second one - 1 hour in advance,
- the third - 15 minutes in advance.
In this variant of the webinars scenario, it is important to take into account cases when the user registered later than one email, but earlier than another. For example, 3 hours before the start: in this case, we should not send him the first email, which goes 24 hours before. This requires:
- in the initial API-request pass the time the user registered for the webinar,
- after - in each email sent, write a code that will check if the person registered later than the time in which the email should be sent to him. Example code to check the time:
var difference = TimeParse(scenarioField.date_webinar) - TimeParse(scenarioField.date_registration); if(difference < 3600) Abort();
This is a code sample for unsend (using the method Abort()
) for 1 hour (= 3600 seconds). If it is an email for 2 hours, we will specify 7200, because there are 7200 seconds in 2 hours, and by analogy for other intervals (5 minutes - 300, 24 hours - 86400, etc.).