In this workflow, you'll learn how to create a conditional flow based on agent availability to check if a message was received when agents were offline. While the bot builder can verify if a message arrived during business hours, it doesn't automatically detect agent availability. To achieve this, you'll need a custom solution with some additional configuration.
The workflow includes the steps below.
- Step 1: Create a bearer token
- Step 2: Create an API connection
- Step 3: Create a conditional statement in the bot builder
Step 1: Create a bearer token
Create a bearer token for the Zendesk Chat API by following the steps in the article: Chat API tutorial: Generating an OAuth token.
Step 2: Create an API connection
Create an API connection by following these steps:
- Select the option Bearer token and enter the token created in step 1.
- Enter the allowed domain value:
rtm.zopim.com
Step 3: Create a conditional statement in the bot builder
- In Admin Center, navigate to Bots and automation > Bot and select your bot
- Under the selected bot, choose the answer intent.
- Add the HTTP API call step with details:
- GET
- Enter the Endpoint URL:
https://rtm.zopim.com/stream/agents/agents_online
- Under Authentication, select the connection created in Step 2
- Click on Make an API call to test the call and return status code 200
- Under the Variable tab, select Open content, then Data
- In Data, you will see agent_online. Click Save adjacent to this and save the variable as is Zendesk creates a variable as
agent_online
which is utilized in the next step
- Under API Successful flow, create a conditional step with options Online and Else.
- Open the Conditional step, and under Options configure the option as Online.
- Add the condition:
agent_online IS NOT 0
- Save and publish the bot.
You have successfully created a condition in your bot to check if agents are available.
Note: The real-time API used above is available to Enterprise plans.