Looking for ideas for replacing our calendar slack plugin

Hi!
We are currently using the Calendar for Teams Slack/Google plugin to remind everyone of upcoming meetings for the day in the #general channel in Slack. This plugin is flaking out and not working as intended, and they are deprecating it as of March 1, 2023 so it will no longer be available.

I’ve looked around a little, but does anyone know of any solutions that could replace this plugin? Maybe something with IFTTT (If This Then That)?

Alternatively, is this something we want to add to our CHAOSS Slack bot? And would we have anyone who would want to work on this?

Replying to my own topic :joy: but that’s ok! It is looking more and more like either Zapier or IFTTT might be our answer here. @georglink I think you set up the IFTTT for Twitter <-> Slack integration. Do you happen to know if there’s an easy way to connect a google calendar with Slack? Also I’m not sure where to find the login info but I’m happy to poke around with this.

Yes, I set up the IFTTT. I found a Calendar <-> Slack integration that might work. I think Zapier might also work. Let me know if you want to sit down together and try it out sometime.

Yes! That would be awesome! I’ll ping you on Slack so we can set up a time. Thanks @georglink!

@Elizabeth – I think this is solved. Can we close this thread?

@germonprez, sure, no worries. I think it’s also ok to keep discussions “open,” as in, they aren’t exactly issues to be closed, but more of just open-ended threads. I’m fine with whatever though; I don’t really have strong feelings about it either way :smile:

For anyone who is keeping track, I’m going to document the solution we came up with.

We are using IFTTT Pro+ which is $60/year but lets you do a whole lot more than the free version. It’s needed to implement this solution:

  1. Set up a daily run time (it’s a standard trigger)
  2. Connect to Google Calendar and use the “List Events for Date” service
  3. Link to Slack and use “Post to Channel”

This is the basic implementation but it really sucks for the end user, as it displays events in random order and formatted like this:

2023-02-27T15:30:00.000Z: Communications Working Group Meeting

(which is not very readable or helpful). So to make it a little nicer, we added a Filter after the Calendar part of the applet, and used this Javascript code:

// TypeScript v2.92

//
// how many events today?
let numevents = GoogleCalendar.listEventsForDate.length;
let strevents=numevents.toString();

//Set the title for the message with total number of events
let title="Today's CHAOSS Agenda: ";
title += strevents;
title += " Events";

//post the title to Slack
Slack.postToChannel.setTitle(title);
Slack.postToChannel.setTitleUrl("https://chaoss.community/chaoss-calendar");

//Grab only the time and title for each event, and sort chronologically since Google gives events in random order
let message = "";
var eventsort=[];
let i=0;

while (i < numevents) {

  //split up hours and minutes to convert to US Central Time Zone (UTC-6)
  let hour = (GoogleCalendar.listEventsForDate[i].Start.slice(11,13));
  let minutes = (GoogleCalendar.listEventsForDate[i].Start.slice(13,16));
  let uscentral = (parseInt(hour)-6) + minutes;

  //put the time and event title together on one line so we can keep them together while we sort
  let line = (GoogleCalendar.listEventsForDate[i].Start.slice(11,16)) + "UTC / " + uscentral + " US Central/Chicago : " +  (GoogleCalendar.listEventsForDate[i].Title) + "<br>";

  //add the whole line to the list of events so we can sort
  eventsort.push(line);

    i++;
}

//now that we have all the events we can sort them chronologically
eventsort.sort();

//add list of events to our Slack message, in order
for (let j = 0; j < eventsort.length; j++) {
  message += eventsort[j];
} 
 

//post the full list of events to Slack
Slack.postToChannel.setMessage(message); 

Just to add a caveat, I haven’t written Javascript in about 10 years so if there’s an easier way to do this, I’m all for it :smile:

The output should look something like this:

We can add more functionality as we go, and if anyone has any ideas let us know!

@Elizabeth - quick question for you. It looks like maybe you are calculating UTC by subtracting 6 from the time of the meeting? If so, this will work well until the US changes to daylight saving time, but UTC doesn’t move for daylight saving time and would at that point only be 5 hours behind central time. It might be better to use a built-in time zone conversion within Javascript, something like this, maybe?

1 Like

@geekygirldawn YESSS! This was my next thing to look at to replace my janky quick-fix of time conversion :smile: Thanks for the pointer, and I’ll see if I can get it to play nicely with Google and Slack. I appreciate you! :pray:

Now that we’re on the subject of time zones - are there any other time zones I should include? Maybe China Standard Time? Is that gonna make things more confusing?

Shucks @geekygirldawn it looks like I’m super limited in the javascript libraries I can use in the IFTTT bubble, and it looks like any native date/time functions in javascript rely on the client’s time zone to make a conversion (which isn’t super helpful in our case). I’ll keep poking around though!