---
schema_version: "1"
id: 73257afe623def352b01cdf1268d68167a22513b7880e56d10305a2cad88421a
title: Auto-Response Component for iOS
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/service-cloud/messaging-in-app/guides/ios-auto-response.md
canonical_url: https://developer.salesforce.com/docs/service/messaging-in-app/guide/ios-auto-response.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 5669e56769745c0551634d904ac7f22171fb9717788465e4f80478d4d6c21a95
products:
  - Enhanced In-App Chat
  - Service Cloud Developer Content
---
# Auto-Response Component for iOS

Send customers structured content (such as survey links) with Messaging auto-response components.


**important:** This feature requires version 1.2.0 or later of the Enhanced In-App Chat SDK.


This article applies to the following implementations:

| UI SDK | Core SDK |
| :----: | :------: |
|   ✅   |    ✅    |


An auto-response is a text or link response sent when a customer initiates a messaging session, a rep joins, or a session ends. This topic describes how to send parameters to Salesforce for the auto-response Messaging component. You can use this component during or after the conversation to show the user a web page, such as a survey. To learn about and set up auto-response components, see [Create a Messaging Component: Auto-Response](https://help.salesforce.com/s/articleView?id=service.messaging_components_auto_response.htm).

**note:** The Enhanced In-App Chat UI SDK automatically displays any auto-response components that you add in Salesforce. You don't write any code to display this component. If you're using the Core SDK, you can process the incoming `ConversationEntry` object as you would any other incoming message. This documentation shows you how to optionally pass additional parameters to the URL that is presented to the user.

After you've set up the auto-response component in Salesforce, you can optionally send additional parameters from the app using the SDK. These parameters are mapped to the path and the query string of the auto-response URL.


1. Implement the [`TemplatedUrlDelegate`](https://salesforce-async-messaging.github.io/messaging-in-app-ios/documentation/smiclientcore/templatedurldelegate) interface. This delegate contains the `didRequestTemplatedValues` method, which the SDK calls to set parameter values.
2. Add your delegate to the SDK using the `CoreClient.templatedUrlDelegate` property. See the [`CoreClient`](https://salesforce-async-messaging.github.io/messaging-in-app-ios/documentation/smiclientcore/coreclient) reference documentation.

```swift
class AutoResponseDelegateImplementation: TemplatedUrlDelegate {

  func core(_ core: CoreClient!,
            didRequestTemplatedValues template: SMITemplateable!,
            completionHandler: URLParameterValueCompletion!) {

    // Add any auto-response values
    for key in template.keys {
        let value = "my auto-response value"
        template.setValue(value, forKey: key)
    }

    // Pass template back to SDK
    completionHandler(template)
  }
}
```

**note:** This sample code requires the configuration object that you created when setting up the UI SDK or the Core SDK. See [Build a UI SDK App](https://developer.salesforce.com/docs/service/messaging-in-app/guide/ios-ui-sdk.md) or [Build a Core SDK App](https://developer.salesforce.com/docs/service/messaging-in-app/guide/ios-core-sdk.md) for more information.

```swift
// Create an instance of the auto-response delegate
let myAutoResponseDelegate = AutoResponseDelegateImplementation()

// Create a core client from a config
let coreClient = CoreFactory.create(withConfig: config)

// Assign the auto-response delegate
coreClient.templatedUrlDelegate = myAutoResponseDelegate
```

After you register your delegate, the SDK automatically calls the `didRequestPrechatValues` method before an auto-response Messaging component is shown.
