getDepartments()

Note: This API is supported from version 10.0.0.

The getDepartments() API fetches the list of departments associated with chat and call flows within the brand's settings.

Navigation:

  • Calls: Settings > Brands > Select your brand > Flow Controls > Calls > Associated departments for calls.
  • Chats: Settings > Brands > Select your brand > Flow Controls > Chat > Associated departments for chats.

Parameter:

completion: A closure that returns the result of the fetch operation. The closure provides either a list of departments or an error if the operation fails.

  • Error: An object describing the failure (or nil if successful).
    • message (String): A brief description of the error.
    • code (Int): A numeric value representing the error code.
  • Departments: An array of SIQDepartment objects, each containing the following properties:
    • id (String): The department's unique ID.
    • name (String): The department's name.
    • available (Bool): Indicates whether the department is currently available (based on operator availability and business hours).
    • mode (SIQCommunicationMode): Indicates the department's communication mode. Returns:
      • call: if the department is configured only for calls.
      • chat: if the department is configured only for chats.
      • chatAndCall: if the department is configured for both chat and call.

Example

CopiedZohoSalesIQ.Conversation.getDepartments { error, departments in
        if let error = error {
            print("Message: \(error.message)")
            print("Code: \(error.code)")
        } else if departments.count > 0 {
            for department in departments {
                print("ID: \(department.id), Name: \(department.name), Available: \(department.available), mode: \(department.mode)")
            }
     
            let callDepartments = departments.call // Returns departments configured for call.
            let chatDepartments = departments.chat // Returns departments configured for chat.
         }
 }