Fetch Availabilities
One of the most important feature of the dialer is the ability to know if a teammate/agent is available or not. This event is used to fetch the availabilities of all the users within the company.
{
  "type": "API.FETCH_AVAILABILITIES"
}
Usage
Successful fetch
When everything goes fine, you will receive a API.FETCH_AVAILABILITIES_FULFILLED event:
{
  "type": "API.FETCH_AVAILABILITIES_FULFILLED",
  "payload": {
    "[userId]": {
      "status": "UserAvailabilityStatus!",
      "wrapUpTimeConfig": "Number",
      "wrapUpTimeTtl": "Number",
      "version": "Number"
    }
  }
}
Something went wrong
If something bad happens, you will receive a API.FETCH_AVAILABILITIES_REJECTED event:
{
  "type": "API.FETCH_AVAILABILITIES_REJECTED",
  "payload": {
    "error": "Error"
  }
}
The error here, will correspond to whatever the backend service returns.
Reference
- userId: the id of the user you want to fetch the availability for
- status: the availability status of the API. It can be one of the following:- offline: the user is offline
- do_not_disturb: the user is unavailable with no specific reason- The user can specify a reason for this status in the Aircall app, which can be either out_for_lunch,on_a_break,in_traning,doing_back_office,other.
 
- The user can specify a reason for this status in the Aircall app, which can be either 
- available: the user is available to receive calls
- on_mobile: the user is logged in to the mobile app
- in_call: the user is in a call
 
- version: the version of the availability. This is used to know if the availability has changed since the last time you fetched it.
- wrapUpTimeConfig: the time that the user configures to become unavailable after each call.
- wrapUpTimeTtl: represents how much time is left for the wrap-up time to expire
Both wrapUpTimeConfig and wrapUpTimeTtl keys will only be present if the agent has configured wrap-up time.