clock/calendar

I was just wondering if there is any way to give the agents access to a clock or calendar purely just for it to be able to understand what the current date and time is while speaking to it, I don't know if this is already a voiceflow feature that i have missed or not but if it isn't a feature I think it would come in handy, especially since no ai specifically has its own internal clock, cheers
4 Replies
Tico | Voiceflow Assistant
Hey there! 👋
Voiceflow doesn’t expose a built-in “system clock” variable, but you can give your agent awareness of the current date & time with a quick Code (or Function) step:
/* Code Step */
const now = new Date();

// store ISO date (YYYY-MM-DD)
variables.current_date = now.toISOString().split('T')[0];

// store local time (24-hour HH:MM)
variables.current_time = now.toLocaleTimeString('en-US', { hour12: false });
/* Code Step */
const now = new Date();

// store ISO date (YYYY-MM-DD)
variables.current_date = now.toISOString().split('T')[0];

// store local time (24-hour HH:MM)
variables.current_time = now.toLocaleTimeString('en-US', { hour12: false });
1. Add a Code Step at the point in the workflow where you need the date/time. 2. Create two Voiceflow variables (e.g. {current_date}, {current_time}) and assign them as shown above. 3. From that point on the agent can reference the variables in replies, conditions, API calls, etc. If you need more granular data (day of week, timezone conversions, etc.) you can: - Extend the same Code Step (now.getDay(), now.getTimezoneOffset(), …), or - Call a time-zone API (e.g. worldtimeapi.org) with an API Step and store the fields you need. That’s all there is to it—no extra setup required.
Docs for the Code Step (in case you need them): https://docs.voiceflow.com Hope this helps, and happy building! 🚀
Braden
Braden2mo ago
we're working on this right now 🙂 @Jake (Ridgefire Ai) cc @Michael Hood (Head of Product)
Samuel
Samuel2w ago
Hey, any updates on this? 🙂 @Jake (Ridgefire Ai) @Michael Hood (Head of Product) @Braden
Braden
Braden5d ago
none yet, we're still thinking through best way to do this @Samuel . For now i'd create a function that returns the time and make it a tool your agent can use

Did you find this page helpful?