Auto birthday emails

Is there a special feature or integration in Glide to trigger an email or SMS for a birthday or anything else? If so, how is it done? Thanks

There is not an easy way to trigger a notification, as that would require that the user be signed in to the App and click on a button or similar.

However, you could detect if today is a users birthday, and present a birthday greeting in the App.

Assuming that you have the users date of birth in your users table, do it as follows:

  • Create two math columns using the following formula:
Month(Date)*100+Day(Date)
  • The first math column should use the special Now value as a replacement
  • The second column should use the column that contains each users date of birth as a replacement
  • If the two math columns return the same number for any user, that means today is their birthday. So you can use that.
  • Add a component with your birthday greeting to any screen, and configure the visibility condition as follows:
    – User Profle->1st Math column equals User Profile->2nd Math column
2 Likes

Thank you, but can this be set up to automatically send an email or text?

As I said, not easily.

It could be done if you have a plan that includes access to the Glide API.
It could also be done if you are using an external data source such as Google Sheets.

1 Like

I am using the Google Sheets with this application.

Okay, so that means that it is possible. But it still doesn’t mean that it is easy.

Two possible options:

  • The no-code option: use an automation tool such as Zapier or Make to scan the data in your Google Sheet once a day, look for user bithday dates that match the current date, and then send an email to each one found.
  • The code option: do the same as above, but using Apps Script.
1 Like

I will have to research this a little more since there are no examples of it. Thanks.

ChatGPT can be your friend as far as having it come up with a script for you for google app scripts.

I will try that. Thanks

1 Like

Will I need the business plan to run a Java Script Action?

Google App Scripts have nothing to do with Glide plans. That’s all in google, and it’s included for free. I use google app scripts to handle various things in my back end data outside of Glide.

And besides, the javascript column is included on all glide plans, but that’s not we are talking about here.

I have created the birthday function in my google sheet, but where do I place an action to trigger it to run in Glide?

You don’t do anything in Glide. With Google App Scripts, you set up an automated script that either runs based on any data changing in a table, or you can set it up to run automatically during a certain time of day.

For example, I have a google app script that runs weekly and creates a backup of my entire google sheet. Another automated script I have is to archive and delete old rows in a couple of my tables. This script runs once a day. These scripts have no association with Glide. They just act on the data in my google sheet.

You should be able to set up your triggers in the Google App Script interface.

1 Like

I this setup in Google Sheets but will it automatically run in Glide with the other math columns you suggested in glide?

Google App Scripts have absolutely nothing to do with Glide. They act on the data that’s available in your google sheets. Assuming you have a Date column, your script should be able to determine who has a birthday or not.

The script would be sending the emails. Not Glide.

1 Like

This video is only an introduction, it needs to be adjusted to suit your needs. Using chat Gpt will help a lot after you watch this video. Hope this helps

1 Like

Below is my birthday script but it is not sending an email. However, it does run. What is wrong with it.

function sendBirthdayWishes() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var data = sheet.getDataRange().getValues();
var today = new Date();

data.forEach(function(row) {
var name = row[0];
var birthday = new Date(row[1]);
var contactInfo = row[2]; // Email or Phone number

if (birthday.getMonth() === today.getMonth() && birthday.getDate() === today.getDate()) {
var message = "Happy Birthday, " + name + “!”;
sendEmailOrSMS(contactInfo, message);
}
});
}

function sendEmailOrSMS(contactInfo, message) {
// Code to send email or SMS
// If sending email, you can use GmailApp
// If sending SMS, you may need to use a third-party service or API
}
function sendEmail() {
var recipient = ‘bsstrick@comcast.net’;
var subject = ‘Test Email’;
var body = ‘This is a test email sent from Google Apps Script’;

MailApp.sendEmail(recipient, subject, body);
}

The one obvious thing is that you call a function (sendEmailOrSMS()) that doesn’t actually do anything :point_down:

function sendEmailOrSMS(contactInfo, message) {
// Code to send email or SMS
// If sending email, you can use GmailApp
// If sending SMS, you may need to use a third-party service or API
}

You probably should be calling the sendEmail() function instead.

If you are new to Apps Script, the first step in debugging is to add console.log() lines at strategic points in the code so you can get the code to log the values of variables at various stages.

A better way (but slightly more advanced) is to use the built in debugger. It allows you to add breakpoints in the code, then run it in debug mode, and step through line by line/function by function.

1 Like

You’re also using the wrong type of quotation marks around the exclamation mark.
Please Use Chat GPT to help review your code.

This was produced with Chatgpt.