Skip to content

Instantly share code, notes, and snippets.

@mb8z
Created March 4, 2021 16:05
Show Gist options
  • Save mb8z/b1c6c2b53a8c477368d666a68fc4be61 to your computer and use it in GitHub Desktop.
Save mb8z/b1c6c2b53a8c477368d666a68fc4be61 to your computer and use it in GitHub Desktop.
const dayjs = require('dayjs');
const { SMS } = require('automagically');
const templates = {
appointmentReminder: 'You have a doctor\'s appointment coming on {{date}}. Assigned doctor: {{doctorFullName}}',
};
const dateFormat = 'YYYY-MM-DD HH:mm';
const send = async () => {
const date = dayjs().format(dateFormat);
const doctorFullName = 'John Doe';
// SMS with the same body
const sms = await SMS.send({
from: { phone: '+44500500500' },
to: [
{ phone: 'PHONE_NUMBER_1', date, doctorFullName },
{ phone: 'PHONE_NUMBER_2', date, doctorFullName },
],
body: templates.appointmentReminder,
});
};
send();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment