Align Scheduling
Tags: cozechallenge, devchallenge, ai, machinelearning
Published: 2024-04-29 02:15:56

*This is a submission for the [Coze AI Bot Challenge](https://dev.to/devteam/join-us-for-the-coze-ai-bot-challenge-3000-in-prizes-4dp7): Bot Innovator.*

## What We Built
We built a scheduling bot that can help facilitate the process of organising events between groups of people, help organise your own personal events, and create documents for things like meetings etc. Using Coze in conjunction with the Google Calendar plugin suite, you will be able to organise team meetings, outings with friends with ease.
## Demo
https://www.coze.com/store/bot/7363083969291714567

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j6ukr2lrfqxpmhf8ud6i.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vh2e0unlqz4764kpyi75.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l9g99zqottwannas6ven.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nohaa9czffar7x3oac1d.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ng3l8hn2epmva66zhs65.png)

https://www.coze.com/store/bot/7363083969291714567
<!-- Share a link to your bot in the Coze Bot Store and include screenshots or recordings showcasing a user's chat interface with your bot. -->


## Your Configuration

### The Prompt
# Character
You're a proficient event organizer and personal schedule manager. You're skilled at synchronizing and organizing users' daily schedules via Google Calendars and Google Tasks. You can set details for events and tasks, and help users access them anytime. Keep your responses concise

## Skills
### Skill 1: Event Management
- Get event details, including start and end time, timezone, and event title, from users. 
- Incorporate those details seamlessly into Google Calendar.
- Delete events at user request. List the events to the user for verification before deleting them
- When requested to update events, list down available events for the user to update. Confirm the new details with the user before making the final changes

### Skill 2: Task Management
- Directly interface with Google Tasks. 
- Schedule, record, and manage tasks as per the user's instructions.
- Create tasks associated with events on the user's google calendar, let the user set the task to be completed a certain time before an event
- Create subtasks if the user requires them

### Skill 3: Retrieve Information
- Provide quick access to event or task data when asked by the user. 
- Read the user's google calendar to retrieve their tasks and events
- Create a unix timestamp for each event using its date and time details when requested.

### Skill 4: Event specific or scheduled reminders
- Allow the user to set reminders at intervals or before events
- Ensure timely reminders are sent when they are supposed to

### Skill 5: Shared Event Creation
- Any user can suggest to the bot to add an event to everyones calendar with the same details
- Users will consent to the event being added to their calendar when they type "Add shared event" after it has been suggested

### Skill 6: Office document creation:
- Create documents with appropriate headers and subheaders and titles for the user based on what they want the document to be about. 
- You can add the content the user provides as well


## Constraints:
- When creating an event, always specify the exact date when returning its details
- If there is an event currently occurring at the same time as an event that wishes to be added, verify with the user that they would like both events to occur 
-When creating a timestamp, convert the local time to utc before creating
- Give a short summary of your capabilities when asked, only elaborate if asked again by user

*REMEMBER If the user types in the keyword "Schedule" get all of the users events from their google calendar in order of occurrence from earliest to latest
*REMEMBER Do NOT fabricate events if there are none scheduled

## Journey
There were alot of ups and downs when implementing this bot. I went through a lengthy trial and error process to ensure that my bot would perform as intended as consistently as possible. Using the many plugins that google has was much more finnicky than I had initially imagined, and they took quite some effort to wrangle in line with the features I had in mind. A few of them still elude me when it comes to getting what I want out of them.

So here's some of the troubles I encountered.

### Google Calendar
First off, I originally wanted to create events on a shared calendar on google calendars. However, due to the current implementation of the Google Calendar plugin, I was unable to specify which calendar I wanted to add the event to. As a result, I decided to work around it and try to get as close as possible by letting the bot "remember" the event when it is suggested and allow users to simply easily add the event to their own calendars without having to manually input identical details. 

### Discord Timestamps
Something else that left me quite stumped and frustrated was a custom plugin I developed. Due to the application being deployed on Discord, I wanted the bot to be able to display times which would be automatically set to the local timezone of whoever was reading the message for scenarios where not everyone is working in the same country, especially in this age of remote working and online relationships. Discord allows this through its use of this format <t:(Unix timestamp)>. 
I was unable to find a plugin on the store which was published to do what I wanted, so I created a simple plugin to convert the date from the user into a timestamp to put into this format when retrieving the user's events from their calendar. However, due to the weird nature of where the bot thinks its local timezone is vs what the timezone actually is, or possibly something else entirely. I was not able to accurately get timestamps during actual bot usage, despite many modifications to the prompt. It would only work in the test runs of the plugin despite the exact same inputs. This is something I wish either I or Coze will solve in the future. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7abl2ogu37pazc49q4kr.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j2cl800nwfcde982wopo.png)

### Google Tasks
Next, We wanted to use the google tasks alongside the google calendar plugins, as that only seemed natural given they are found quite related on google calendar's site. However, the limitation of the task plugin on Google's end as well as some other unknown to me factors, I could not set tasks which had a due date at all, nor could i set tasks with subtasks reliably. Thus this remains an incomplete feature. 

### Scheduled Triggers
Finally, We wanted the bot to carry out a daily reminder to the user, informing them of their schedule for the day. We spent quite awhile trying to get it to work on telegram and on Coze's preview, Silly of us, as soon after I checked the documentation to find it was only supported on Discord and Lark, influencing our decision to deploy it on Discord. So, I am happy to say this function now works well on Discord.

We am quite happy with the performance of this bot, and will continue to iterate on it as improvements are made to the plugins and features are added. I am excited for the future of Coze, and hope to explore all it may come to offer!

<!-- Tell us about your process, what you learned, anything you are particularly proud of, what you hope to do next, etc. -->
## Contributors
@jaydenchowjw 
@sharee10 

<!-- Team Submissions: Please pick one member to publish the submission and credit teammates by listing their DEV usernames directly in the body of the post. -->

<!-- Don't forget to add a cover image (if you want). -->

<!-- Thanks for participating! -->