Scheduling Bots Close to the Present

Last updated: October 30, 2024

Sometimes you may need to schedule or reschedule a bot to a time near in the future. Below are the best practices for handling these scenarios.

Rescheduling a bot

When a meeting is moved from the future to close to the present, there are two ways to handle this depending on how close to the present the new time is.

Scenario 1: Reschedule the Bot

  1. If the meeting is in the near future but not immediate, use the reschedule endpoint to update the bot's join_at time. A good rule of thumb is > 10 minutes into the future.

  2. Be aware that if the new time is too close to the present, you may receive a 400 error with the code update_bot_failed and the detail Not enough time to launch new bot.

Scenario 2: Delete and Create an Ad-hoc Bot

  1. If you need the bot to join immediately or if rescheduling fails:

    1. Delete the scheduled bot.

    2. Create a new ad-hoc bot by calling the Create bot endpoint without specifying a join_at time.

To handle all scenarios, consider implementing the following logic:

  1. Attempt to reschedule the bot to the new time.

  2. If rescheduling fails with a 400 error (update_bot_failed), fall back to deleting the scheduled bot and creating an ad-hoc bot.

  3. If you know for certain that you need the bot to join immediately, you can skip the rescheduling attempt and directly delete the scheduled bot and create an ad-hoc one.

Creating a bot for the near future

Creating bots for a time close to the present (distinct from rescheduling using Update Scheduled Bot) is slightly different due to the underlying mechanism.

When creating a bot for immediate or near-future use:

  • You can call the Create Bot API with a join_at time close to the present (e.g., 1 minute in the future).

  • If there isn't enough time to schedule a new bot, the system will automatically use an ad-hoc bot from the pool.

  • In rare cases, you might receive a 507 error if the ad-hoc bot pool is depleted. If this occurs, wait 15-30 seconds and retry the request.

Summary

1. For rescheduling, aim for at least a 5-minute gap between the current time and the new join_at time to avoid potential errors.

2. When you need a bot immediately, it's often simpler to delete the scheduled bot and create a new ad-hoc bot.

3. Handle potential errors (400 for rescheduling, 507 for ad-hoc bot creation) in your code to ensure smooth operation.