How do I know that a request to close a ticket was received?

In the quickstart-desk-android, there is an implemented feature that a message with green “yes” and red “no” buttons is shown when a request to close the ticket is made.

How do I implement the same thing in the quickstart-desk-ios?
And how and where do I receive the request?

Hello @Martin_Hovhannisyan,

You can follow this documentation [Confirmation request message | Desk iOS SDK | Sendbird Docs] to build similar feature in iOS.

Let me know in case you need additional help.

@uday.bhaskar thanks for the info!

What I can’t figure out is where exactly the messages are received.

Here’s my ChatViewController class

import SendBirdDesk
import SendbirdUIKit
import UIKit

class ChatViewController: SBUGroupChannelViewController {
    var ticket: SBDSKTicket!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.useRightBarButtonItem = false
        
        let myView = UILabel()
        if let agent = ticket.agent {
            myView.text = agent.name
                } else {
                    myView.text = "Jans Huisartsen"
                }
            
        self.titleView = myView
    }
}

extension ChatViewController: DeskChannelModuleListDelegate {
    func deskChannelModule(_ listComponent: SBUGroupChannelModule.List, didSelectQuestion question: String, forID faqFileID: Int64) {
        ticket.selectQuestion(faqFileId: faqFileID, question: question) { error in
            // ...
            // This will send admin message:
            // e.g. "The customer selected {question}"
        }
    }
}

protocol DeskChannelModuleListDelegate: SBUGroupChannelModuleListDelegate {
    func deskChannelModule(_ listComponent: SBUGroupChannelModule.List, didSelectQuestion question: String, forID faqFileID: Int64)
}

class DeskChannelModule {
    class List: SBUGroupChannelModule.List, FAQBotMessageCellDelegate {
        override func setupViews() {
            // Register XIB: SystemBotMessageCell
            let systemBotNib = UINib(nibName: SystemBotMessageCell.identifier, bundle: nil)
            tableView.register(systemBotNib, forCellReuseIdentifier: SystemBotMessageCell.identifier)
            
            // Register XIB: FAQBotMessageCell
            let faqBotNib = UINib(nibName: FAQBotMessageCell.identifier, bundle: nil)
            tableView.register(faqBotNib, forCellReuseIdentifier: FAQBotMessageCell.identifier)
            
            // Register XIB: DefaultMessageCell
            let defaultMessageNib = UINib(nibName: DefaultMessageCell.identifier, bundle: nil)
            tableView.register(defaultMessageNib, forCellReuseIdentifier: DefaultMessageCell.identifier)
            
            super.setupViews()
        }
        
        override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
            let message = fullMessageList[indexPath.row]
            
            // When message has FAQ data or not
            if let faqData = SBDSKFAQData(with: message) {
                UIView.setAnimationsEnabled(false)
                
                // Create FAQBotMessageCell
                let cell = tableView.dequeueReusableCell(withIdentifier: FAQBotMessageCell.identifier, for: indexPath) as! FAQBotMessageCell
                cell.contentView.transform = CGAffineTransform(scaleX: 1, y: -1)
                cell.selectionStyle = .none
                // To receive selection event
                cell.delegate = self
                // Configure the cell with message info
                cell.configure(message: message, faqData: faqData)
                
                UIView.setAnimationsEnabled(true)
                
                return cell
            }
            // When message is systemt bot message
            else if message.customType == "SENDBIRD:AUTO_EVENT_MESSAGE" || message.data == "{\"type\": \"NOTIFICATION_AUTO_CLOSED\"}" {
                UIView.setAnimationsEnabled(false)
                
                let cell = tableView.dequeueReusableCell(withIdentifier: SystemBotMessageCell.identifier, for: indexPath) as! SystemBotMessageCell
                cell.contentView.transform = CGAffineTransform(scaleX: 1, y: -1)
                cell.selectionStyle = .none
                
                cell.configure(message: message)
                
                UIView.setAnimationsEnabled(true)
                
                return cell
            }
            // Default message
            else {
                return super.tableView(tableView, cellForRowAt: indexPat
            }
        }
        
        func didSelectQuestion(_ faqFileID: Int64, question: String) {
            (self.delegate as? DeskChannelModuleListDelegate)?
                .deskChannelModule(self, didSelectQuestion: question, forID: faqFileID)
        }
    }
}

Jumping to the definition of fullMessageList opens the SendbirdUIKit
image

The same is with filtering system messages: I can’t figure out where I can catch the messages and filter them with the provided isVisible function.

1 Like