Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Corresponding Calls for Chat Buttons
Make sure your chats start correctly by aligning your calls when using buttons,
direct-to-agent, and agent with fallback-to-button.
Keep in mind that the syntax for startChat also applies to startChatWithWindow, and the syntax for showWhenOnline also applies to showWhenOffline.
Use the following corresponding calls when you’re creating chats with a button, direct-to-agent, and agent with fallback-to-button:
| Scenario | Call to startChat (or startChatWithWindow) | Call to showWhenOnline (or showWhenOffline) | Call to addButtonEventHandler |
|---|---|---|---|
| Button | startChat(String buttonId) | showWhenOnline(String buttonId, Object element, (optional) String userId) | addButtonEventHandler( String buttonId, Function callback) |
| Agent (no fallback) | startChat(String buttonId, String userId, false) | showWhenOnline(String userId, Object element) | addButtonEventHandler( String userId, Function callback) |
| Agent (fallback to button) | startChat(String buttonId, String userId, true) | showWhenOnline(String buttonId, Object element, String userId) | Use multiple handlers. |