displayNotification

Display a voice call notification to the Front teammate

📘

This function is only available on context of types singleConversation and multiConversations

📘

This function currently only supports incoming call notifications

The displayNotification function is meant to be paired with application channels for voice calls.

function displayNotification(type: string, contact?: Contact, cancelToken?: CancelToken): Promise<string>;

Parameters

ParameterTypeDescription
typeStringThe type of notification. Currently only supports INCOMING_CALL
contactObjectAn object identifying the caller.
contact: { name: string, handle?: string }
cancelTokenCancelToken (optional)Token to cancel the request.

Usage

This function should be used to open a notification to alert the user of important plugin activity that requires immediate attention, such as receiving an incoming voice call.

For voice calls, the notification displays the caller's name and number, as well as a button that reads Open YOUR_APP_NAME to open the sidebar plugin.


📘

Enable the Run in background setting in your plugin configuration to allow this function to emit notifications when your plugin is closed or not in focus.

Return value

The function returns the string identifier for the notification. Use this identifier in the dismissNotification function to close the notification.

Examples

Front.displayNotification('INCOMING_CALL', {
  contact: {
    name: 'Harry S. Truman',
    handle: '1-900-860-0911'
  }
});