AlertingApi
Handles aspects of alerting and attention of this app with Genesys Cloud
since
1.0.0
Hierarchy
↳ AlertingApi
Index
Methods
Methods
setAttentionCount
▸ setAttentionCount(count
: number): void
Displays badging for unread messages and notifications
myClientApp.alerting.setAttentionCount(2);
myClientApp.alerting.setAttentionCount(0);
since
1.0.0
Parameters:
Name | Type | Description |
| number | The updated number of unread messages or notifications |
Returns: void
showToastPopup
▸ showToastPopup‹MessageType, Timeout›(title
: string, message
: string, options?
: ToastOptions‹MessageType, Timeout›): void
Displays a toast popup.
Permanent/Sticky toasts are not allowed. Therefore, toasts must specify either a manual dismissal (showCloseButton: true
) or an automatic dismissal (timeout > 0
). Both showCloseButton
and timeout
can be specified to provide both dismissal options.
Error toasts (type: 'error'
) require manual dismissal and must be explictly specified with showCloseButton: true
. TypeScript users will also specify timeout: 0
while JavaScript users can specify 0 or omit the prop entirely. The timeout
prop will be ignored regardless.
Toast Options:
Name | Type | Default | Description |
| string | your app's namespace | The id of the message. Duplicate IDs will replace each other in the toast display. All IDs will be namespaced with your app ID to avoid collisions. Default will just be your app's namespace and will not support multiple messages. |
| 'error' | 'info' | 'success' | 'info' | The type of the toast message. |
| boolean | true | Indicates if the message is in MD. |
| number | 7 | Time in seconds to show the toast. Set to |
| boolean | true | Indicates if the close button should be shown. Must be explicitly set to true when |
The type parameters impact the options config. The MessageType
type extends 'error' | 'info' | 'success'
, and when it is set to 'error'
, it enforces that timeout
is 0
. The Timeout
type extends number
, and when set to 0
it enforces that showCloseButton
is true
to prevent a permanent toast message.
myClientApp.alerting.showToastPopup("Hello world", "Hello world, how are you doing today?");
var options = {
type: 'success'
};
myClientApp.alerting.showToastPopup("Hello world", "Hello world, how are you doing today?", options);
var options = {
id: 'greeting',
timeout: 0,
showCloseButton: true
};
myClientApp.alerting.showToastPopup("Hello world", "Hello world, how are you doing today?", options);
// Set new id so the messages can show together
options.id = 'exit'
myClientApp.alerting.showToastPopup("Goodbye world", "See you later world", options);
var options = {
id: 'mdExample',
markdownMessage: true
};
myClientApp.alerting.showToastPopup("Hello world", "Hello :earth_americas: How are *you* doing today?", options);
since
1.0.0
Type parameters:
▪ MessageType: ValidMessageType
▪ Timeout: number
Parameters:
Name | Type | Description |
| string | Toast title. |
| string | Toast Message. Supports emoticons, emoji (unicode, shortcodes) and markdown (with markdownMessage boolean). |
| ToastOptions‹MessageType, Timeout› | Additonal toast options. |
Returns: void