In this tutorial, let's look at two basic scenarios for automating webinar mailings:
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" } }
Important! The contact must be in the enKod contact database.
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:
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»).
The concept remains the same, only now you need to send 3 emails before the webinar starts:
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:
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.).