Handle Custom URLs in Chat

Have your agents pass along custom URLs to perform specific actions in your mobile app.

The legacy chat product is scheduled for retirement on February 14, 2026, and is in maintenance mode until then. During this phase, you can continue to use chat, but we no longer recommend that you implement new chat channels. To avoid service interruptions to your customers, migrate to Messaging for In-App and Web before that date. Messaging offers many of the chat features that you love plus asynchronous conversations that can be picked back up at any time. Learn about chat retirement in Help.

Important

When an agent sends a standard link to a user in your app, a preview tile appears that the user can tap to view in a browser. However, you can come up with your own URL scheme that displays a custom tile and performs a custom action within your app.

  1. Create a custom URL scheme and expression.

    Create a URL scheme using the SCSAppEventList class. This class allows you to add URLs either for specific paths (such as action/settings) or using regular expressions (such as action\\/a.*). Patterns are matched in the order that you add them to the SCSAppEventList object. Be sure to add items starting with the most specific and ending with the most generic.

    1// Create an app event list
    2// TO DO: Replace "servicesdk" with your own unique scheme
    3let eventList = SCSAppEventList(scheme: "servicesdk")
    4
    5// Add a regular expression for a path
    6eventList.addDescription("Tap for regex action", withExpression: "action\\/a.*")
    7
    8// Add a custom path for a specific path
    9eventList.addDescription("Tap for path action", forPath: "action/settings")
  2. Add the event list to your SCSChatConfiguration object.
    1// Create a chat config object
    2let config = SCSChatConfiguration(liveAgentPod: "YOUR_POD_NAME",
    3                                  orgId: "YOUR_ORG_ID",
    4                                  deploymentId: "YOUR_DEPLOYMENT_ID",
    5                                  buttonId: "YOUR_BUTTON_ID")
    6
    7// … Perform other chat configuration setup …
    8
    9// Add event list to chat configuration
    10config.eventList = eventList
  3. Implement the SCSChatInterfaceDelegate delegate so that you can handle when the user taps on the URL.
    1class MyChatDelegate: SCSChatInterfaceDelegate {
    2
    3  func interface(_ interface: SCSChatInterface!, 
    4                   didReceiveAppEventWith URL: URL!) 
    5
    6        // Get path
    7        guard let fullPath = (URL as NSURL).resourceSpecifier else { return }
    8
    9        // Minimize chat window
    10        ServiceCloud.shared().chatUI.minimize()
    11
    12        if fullPath.contains("action/settings") {
    13            // TO DO: Perform some action for this url
    14            return
    15        }
    16
    17        if fullPath.contains("action/alert") {
    18            // TO DO: Perform some action for this url
    19            return
    20        }
    21
    22        // NOTE: You can maximize the chat window using
    23        //       ServiceCloud.shared().chatUI.maximize()
    24  }
    25}
  4. Add your delegate to the chat interface.
    1ServiceCloud.shared().chatUI.delegate = myChatDelegate