Please excuse our look. We're just getting started here.
Want to learn more about Twilio Forums? Check out our FAQ page here.Is there a Time of Day Routing on IVR Widget?

Is there a Time of Day Routing on IVR Widget? If it is not available, what is simplest way to allow routing of calls to different destination during different time/day?
Best Answer
-
I'm glad you were able to get it working!
As for the minutes, another variable would be needed to check against for that instead of using the hours.
const hour = now.hour(); const min = now.minute();
Then you would be able to check the half past on the min variable instead.
The momentjs docs page below references more variables that you'd be able to check against as well (day of year/week of year/etc).
Answers
-
Hi @siekiong , great question. I have reached out to our support team in hopes of getting you a solution. Thank you for your patience!✨
-
@siekiong There is an option to build out on the Time of Day Routing example for Functions: https://www.twilio.com/docs/runtime/quickstart/serverless-functions-time-of-day-routing you could build the logic in the function directly or pass the time of day back to Studio (or wherever you are building you IVR) to decide what to do with the time of day.
-
@sbrijmohan,
I am not sure how to modify the TODRouting Function to pass the logic back to Studio. I even checked that the isOpen variable is true - when open and false - not open but not able to pass this parameter back to Studio to use on Split Key widget. Any assistance to help me pass this info from function to Studio will be greatly appreaciated.
-
Hi, you would be able to pass your information back to Studio using JSON. I have shown the before and after in the code snippets below:
const isOpen = businessHours(); twiml.say(`Business is ${isOpen ? 'Open' : 'Closed'}`); return callback(null, twiml);
const isOpen = businessHours(); return callback(null, {"isOpen": isOpen});
In Studio, the response from the Run Function widget would be stored as
widgets.{widget_name}.parsed.isOpen
Run Function widget information: https://www.twilio.com/docs/studio/widget-library/run-function
-
Thank and I got it working. However I would like to know how to specify 9:30 and 5:30pm? I can see the example are 8-17 but there is no example for half pass 17:30. I tried adding :30 to 17 then the script stop working.
-
Thanks. that solved my issue. Thank you very much :)
Categories
- 83 All Categories
- 19 SIGNAL 2021
- 376 Product Discussions
- 7 Community - Announcements
- 2 Changelog
- 4 Forum UI Updates
- 8 Welcome Guide
- 6 Community - Events
- 2 Twilio Relay Developer Conference 2021 Mega Thread
- 1 External Community Events
- 25 Inspiration
- 17 Community - Other Discussions
- 1 Community- Twilio Startups