Connecting Slack with Google Calendar is one effective way to save time and stay organized in your business.
With Wayscript, we can create effective integrations using the Wayscript platforms and its powerful tools. And in this article, we'll create a Google Calendar and Slack Integration that remind events ahead every day.
No prerequisites but some content you might find helpful :
Our workflow should look like something like this:
- Time trigger: Set the time we want the script to run
- Events list are imported from Google Calendar
- A loop through the events list to first format the date properly and send the message on the slack channel
We will use the time trigger and choose the hour the script will run. I set the time to 10:00 am but you can change it.
The next step is to retrieve the events. For this purpose, we will use the Google Calendar module and configure it.
If you have a dedicated calendar for your business meetings or special events, you can easily change the input. And also as you want only the next event, I suppose you to set the number of events to 2.
For the output, let’s choose Events. It’s a list of dictionary object and it will be easy to manipulate with Python.
Well, before working on the date, we must loop through the Event list. To make it, add a loop step. We'll loop through Events variable.
Why using Python? It’s simple and Wayscript provides every tool you need to create amazing scripts. Add a new step and select Python. For this example, the code is quite simple because we are only working on the start date. Each event item has a key for the starting date of the event.
Now, let’s get rid of the last numbers to make the date look good and register the value.
The Slack module comes with a lot of configuration for various integrations. Adding the Slack module, we'll configure the mode, choose the channel, and choose what we would like to do.
Now, let’s configure Slack and write the message we want to send.
Once it's done, we'll be writing data to the channel. Let's fill the message input with the text we want to send.
Don't forget to switch on the Time Trigger so Wayscript will handle the running of the script for you.
Questions about this script or anything else? Join our discord. We're always around to help. If you want to work the full script template, just find it here.
Top comments (0)