This profile will trigger every day at the same time, go through your contacts and for each contact check if they have an event that day. If they do it'll send an SMS message to them.
At the time of writing you'll need the AutoContacts Beta to access the Query 2.0 action. Get it here.
STEP 1 - EVERY DAY GET CONTACT EVENTS
By selecting these fields you'll make AutoContacts only get info for contacts that have event date information.
- Create a new profile with the Time Tasker condition
- Set the start and end dates to the same value, for example 1:30 pm
- In the task add an AutoContacts Query 2.0 action
- Set it to sort by Next Event Date
- In the Fields To Get field select the Event Next Date and Event Type Label in addition to the already selected fields
- In the Task add a flash action showing the returned variables
STEP 2 - GET DIFFERENCE BETWEEN DATES AND TODAY
This will create a loop where %index will be set to 1,2,3,4,etc... where the max value will be number of items in the %acevent_next_date() array. More info here
- Add For and a End For actions
- In the For set Variable to %index and Items to 1:%acevent_next_date(#)
%acevent_next_date(%index) will contain each date for each loop iteration
- Add an AutoTools Time action inside the For loop
- Under Time Span Between Dates set the Start time Date Millis to %acevent_next_date(%index)
- Set the Date Format to yyyy-MM-dd
- Set the End Date to Now
- Select Total Hours under Fields to Get
STEP 3 - SHOW EVENTS FOR TODAY
AutoTools compares the time from the event with the current time. If that time span is greater than 0 it means that we're on the day of the event.
- After the AutoTools Time action add an If-End If condition and set the condition to %atdatestotalhours greater than 0
For example, if someone has a birthday on 2017-01-26 and the current date is 2017-01-26 1:30 pm then the time span between these dates will be 13 and a half hours.
If someone has a birthday on a different day like 2017-01-27 for example, the difference would be a negative value because we wouldn't be at that date yet.
This will send SMS for all types of events! If you only want to send for Birthdays for example, add another If condition that checks if %event matches Birthday
- Inside the If set 3 variables: %name to %acname(%index), %event to %acevent_type_label(%index) and %contactid to %acid(%index).
- Add another AutoContacts Query 2.0 action where you filter by contact ID, and get the default phone number
- Add a Flash action with the text %name has a %event today! Contact at %acnumber
STEP 4 - STOP CHECKING IF DATE IS NOT TODAY
Since the contacts are ordered by Next Event Date when you reach a date that is not from today, you know that all the other dates are not from today so you can stop the task
- Add an Else condition to the If and make the task Stop there
STEP 5 - SEND SMS
- Add a Send SMS action and set the Number field to %acnumber and the Message field to Happy %event %name!
Now when the task runs it'll send an SMS to everyone that has an event that day!
Automatically send birthday wishes to your contacts
Learn how you can check which contacts have a birthday every day and send an automated SMS