Appointment Reminder

Back to Home

A personalized appointment reminder built using Salesforce Marketing Cloud concepts, AMPscript, SQL, Data Extensions, MJML and HTML.

AMPscript SQL Data Extensions Automation Studio MJML HTML Email

Email Preview

Description

A technical consulting company allows customers to schedule consultation sessions for different technologies.

The reminder email is sent one day before the appointment and dynamically displays the customer's name, appointment details, technology, session duration and preparation instructions.

A customer can have multiple appointments over time, but only one session can be booked per day.

Automation Flow

Appointments DE
       ↓
SQL Query
       ↓
Tomorrow's Scheduled Appointments
       ↓
Sendable DE
       ↓
Verification
       ↓
Staging DE
       ↓
Email Send
       ↓
AMPscript Personalization
       ↓
Personalized Email

SQL handles the audience selection while AMPscript handles the personalization inside the email.

Data Model

Customers

SubscriberKey
FirstName
LastName
Email

Appointments

AppointmentID
SubscriberKey
MeetingDate
TechStackID
SessionDuration
Status

Technology

TechStackID
TechStackName
SupportNumber
Customers
    │
    │ SubscriberKey
    â–¼
Appointments
    │
    │ TechStackID
    â–¼
Technology

SQL

The SQL query selects tomorrow's scheduled appointments before the email send.

SELECT
    AppointmentID,
    SubscriberKey,
    MeetingDate,
    TechStackID,
    SessionDuration,
    Status
FROM Appointments
WHERE CAST(MeetingDate AS DATE)
      = CAST(DATEADD(DAY, 1, GETDATE()) AS DATE)
AND Status = 'Scheduled'

AMPscript

AMPscript retrieves the customer, appointment and technology information and prepares the dynamic content used in the email.

set @subscriberKey = AttributeValue('SubscriberKey')
set @firstName = ProperCase(AttributeValue('FirstName'))
set @email = AttributeValue('Email')

/*Appointment DE*/
set @appointmentRows = LookupRows('Appointments', 'SubscriberKey', @subscriberKey)

if(RowCount(@appointmentRows) > 0) then
  set @appointmentRow = Row(@appointmentRows, 1)
  set @meetingDate = Field(@appointmentRow, 'MeetingDate')
  set @techStackId = Field(@appointmentRow, 'TechStackID')
  set @appointmentId = Field(@appointmentRow, 'AppointmentID')
  set @sessionDuration = Field(@appointmentRow, 'SessionDuration')
endif

/*Format appointment date*/
if(not empty(@meetingDate)) then
  set @formattedMeetingDate = FormatDate(@meetingDate, "MMMM dd, yyyy hh:mm tt")
endif

Dynamic Session Message

The preparation message changes depending on the technology selected for the appointment.

/*Session preparation message*/
if @techStackId == "SFMC" then
  set @sessionMessage = "Please have your Marketing Cloud requirements and current email or automation examples ready."
elseif @techStackId == "SFDC" then
  set @sessionMessage = "Please have your Salesforce CRM requirements and current business process details ready."
elseif @techStackId == "MULESOFT" then
  set @sessionMessage = "Please have your API documentation and integration requirements available."
else
  set @sessionMessage = "Please have your technical requirements ready for discussion."
endif

Key Features

Dynamic Personalization Customer and appointment details.
Multiple DE Lookups Customer → Appointment → Technology.
Conditional Content Technology-specific preparation messages.
Dynamic URLs Appointment-specific Reschedule and Cancel links.
Date Formatting Customer-friendly appointment date and time.
Responsive Email Email structure developed using MJML and HTML.

Source Code

The complete AMPscript, SQL, MJML and HTML files are available on GitHub.


View Project on GitHub