How to check if an attendant is available in Builder May 18, 2023 21:58 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: Note: Use the url with the contract id to consume the endpoints reported below, its performance and operation may be impacted if it does not have the contract id, so it is essential to use the url with the contract id to use http requests! Request Method: POST URL: https://{{contractid}}.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, visit the discussion on the subject in our community or the videos on our channel. 😃. Related articles Agent Availability Check How to check available attendants by team Creating interactive messages in WhatsApp Builder variables Blip media upload policy