AgentforceUIDelegate
Protocol that enables customization of user interactions and conversation behavior within Agentforce UI components. Implement this protocol to intercept and modify utterances before sending, receive notifications about conversation events, and handle agent switching scenarios.
| Method | Signature | Description |
|---|---|---|
modifyUtteranceBeforeSending | func modifyUtteranceBeforeSending(_ utterance: AgentforceUtterance) async -> AgentforceUtterance | Allows modification of user utterances before they are sent to the agent. Returns the original utterance unchanged by default. |
didSendUtterance | func didSendUtterance(_ utterance: AgentforceUtterance) | Called after an utterance has been successfully sent to the agent. No-op by default. |
userDidSwitchAgents | func userDidSwitchAgents(newConversation: AgentConversation) | Called when the user switches to a different agent during a conversation. No-op by default. |
userInitiatedVoice | func userInitiatedVoice(for conversation: AgentConversation) | Called when the user initiates a voice interaction for a conversation. No-op by default. |
Use userInitiatedVoice to present your own instance of AgentforceVoiceView. userInitiatedVoice is called when a user taps the button that opens the voice view from the chat view.
This sample code demonstrates rerendering the view when a user selects the voice option.