How to check if an attendant is available in Builder Victoria Alves June 07, 2022 16:40 Updated Although it is simple to send a customer for human assistance, the user experience can be very compromised if there is no attendant available in the tool (as in the Blip Desk for example), since the bot stops responding and all messages are directed for the human being. It is extremely important to analyze if there is an attendant available in the service tool, before sending any user. To check if there is an attendant available in Builder follow the steps below: 1. Create a block with the name "Attendant validation". This block must come before the Human Service block. 2. In the block created in step 1 add an HTTP Request input action, following the data below: Request Method: POST URL: https://http.msging.net/commands Header: Content-Type: application/json Authorization: Key API-KEY-BOT Body: { "id": "{{random.guid}}", "to": "postmaster@desk.msging.net", "method": "get", "uri": "/attendants"} Response status variable: status Response body variable: result 3. Add one more input action (after the HTTP request action created in step 2) of type Script JS, with the script below: Input variable for the function: result Source code: // Receive the variables as parametersfunction run(result) { result = JSON.parse(result); let hasAttendant = false; if(result.resource && result.resource.total >= 1){ hasAttendant = result.resource.items.some(function(attendant){ return attendant.status === 'Online'; }); } return hasAttendant;} Variable for the return value: hasAttendant 4. Define two exit conditions in the block created in step 1. One of the conditions (hasAttendant = true) will be executed if there is at least 1 attendant available and the other condition (hasAttendant = false) will be executed if there is no attendant available. Add the Human Service block only in the outbound condition that represents the availability of attendants. For more information, access the discussion on the subject in our community or the videos on our channel. 😃 Related articles Creating Your Interactive Messages Builder exit conditions Setting up Desk Human Service in Builder How to create a chatbot with Builder Action: Run script