npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

capacitor-twilio-voice

v0.0.1

Published

Capacitor plugin for FCM push notifications and voice calls using Twilio Voice SDK on Android and iOS

Downloads

27

Readme

capacitor-twilio-voice

Capacitor plugin for FCM push notifications and voice calls using Twilio Voice SDK on Android and iOS

Install

npm install capacitor-twilio-voice
npx cap sync

API

registerTwilio(...)

registerTwilio(options: { accessToken: string; registrationToken: string; userId: string; windowToken: string; }) => Promise<void>

| Param | Type | | ------------- | ----------------------------------------------------------------------------------------------------- | | options | { accessToken: string; registrationToken: string; userId: string; windowToken: string; } |


register()

register() => Promise<void>

Register the app to receive push notifications.

This method will trigger the 'registration' event with the push token or 'registrationError' if there was a problem. It does not prompt the user for notification permissions, use requestPermissions() first.

Since: 1.0.0


checkPermissions()

checkPermissions() => Promise<PermissionStatus>

Check permission to receive push notifications.

On Android the status is always granted because you can always receive push notifications. If you need to check if the user allows to display notifications, use local-notifications plugin.

Returns: Promise<PermissionStatus>

Since: 1.0.0


requestPermissions()

requestPermissions() => Promise<PermissionStatus>

Request permission to receive push notifications.

On Android it doesn't prompt for permission because you can always receive push notifications.

On iOS, the first time you use the function, it will prompt the user for push notification permission and return granted or denied based on the user selection. On following calls it will currect status of the permission without prompting again.

Returns: Promise<PermissionStatus>

Since: 1.0.0


addListener('registration', ...)

addListener(eventName: 'registration', listenerFunc: (token: Token) => void) => Promise<PluginListenerHandle> & PluginListenerHandle

Called when the push notification registration finishes without problems.

Provides the push notification token.

| Param | Type | | ------------------ | ----------------------------------------------------------- | | eventName | 'registration' | | listenerFunc | (token: Token) => void |

Returns: Promise<PluginListenerHandle> & PluginListenerHandle

Since: 1.0.0


addListener('registrationError', ...)

addListener(eventName: 'registrationError', listenerFunc: (error: RegistrationError) => void) => Promise<PluginListenerHandle> & PluginListenerHandle

Called when the push notification registration finished with problems.

Provides an error with the registration problem.

| Param | Type | | ------------------ | ----------------------------------------------------------------------------------- | | eventName | 'registrationError' | | listenerFunc | (error: RegistrationError) => void |

Returns: Promise<PluginListenerHandle> & PluginListenerHandle

Since: 1.0.0


addListener('pushNotificationReceived', ...)

addListener(eventName: 'pushNotificationReceived', listenerFunc: (notification: PushNotificationSchema) => void) => Promise<PluginListenerHandle> & PluginListenerHandle

Called when the device receives a push notification.

| Param | Type | | ------------------ | ---------------------------------------------------------------------------------------------------- | | eventName | 'pushNotificationReceived' | | listenerFunc | (notification: PushNotificationSchema) => void |

Returns: Promise<PluginListenerHandle> & PluginListenerHandle

Since: 1.0.0


addListener('pushNotificationActionPerformed', ...)

addListener(eventName: 'pushNotificationActionPerformed', listenerFunc: (notification: ActionPerformed) => void) => Promise<PluginListenerHandle> & PluginListenerHandle

Called when an action is performed on a push notification.

| Param | Type | | ------------------ | -------------------------------------------------------------------------------------- | | eventName | 'pushNotificationActionPerformed' | | listenerFunc | (notification: ActionPerformed) => void |

Returns: Promise<PluginListenerHandle> & PluginListenerHandle

Since: 1.0.0


addListener('twilioRegistration', ...)

addListener(eventName: 'twilioRegistration', listenerFunc: (token: Token) => void) => Promise<PluginListenerHandle> & PluginListenerHandle

Called when the twilio registration finishes without problems.

| Param | Type | | ------------------ | ----------------------------------------------------------- | | eventName | 'twilioRegistration' | | listenerFunc | (token: Token) => void |

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


addListener('twilioRegistration', ...)

addListener(eventName: 'twilioRegistration', listenerFunc: (error: RegistrationError) => void) => Promise<PluginListenerHandle> & PluginListenerHandle

Called when the twilio registration finishes without problems.

Provides the fcm notification token.

| Param | Type | | ------------------ | ----------------------------------------------------------------------------------- | | eventName | 'twilioRegistration' | | listenerFunc | (error: RegistrationError) => void |

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


addListener('twilioRegistrationError', ...)

addListener(eventName: 'twilioRegistrationError', listenerFunc: (token: Token) => void) => Promise<PluginListenerHandle> & PluginListenerHandle

Called when the twilio registration finishes with problems.

Provides an error with the registration problem.

| Param | Type | | ------------------ | ----------------------------------------------------------- | | eventName | 'twilioRegistrationError' | | listenerFunc | (token: Token) => void |

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


removeAllListeners()

removeAllListeners() => Promise<void>

Remove all native listeners for this plugin.

Since: 1.0.0


Interfaces

PermissionStatus

| Prop | Type | Description | Since | | ------------- | ----------------------------------------------------------- | -------------------------------------------- | ----- | | receive | PermissionState | Permission state of receiving notifications. | 1.0.0 |

PluginListenerHandle

| Prop | Type | | ------------ | ----------------------------------------- | | remove | () => Promise<void> |

Token

| Prop | Type | Description | Since | | ----------- | ------------------- | ------------------------------------------------------------------------ | ----- | | value | string | On iOS it contains the APNS token. On Android it contains the FCM token. | 1.0.0 |

RegistrationError

| Prop | Type | Description | Since | | ----------- | ------------------- | -------------------------------------------------- | ----- | | error | string | Error message describing the registration failure. | 4.0.0 |

PushNotificationSchema

| Prop | Type | Description | Since | | ------------------ | -------------------- | -------------------------------------------------------------------------------------------------------------------- | ----- | | title | string | The notification title. | 1.0.0 | | subtitle | string | The notification subtitle. | 1.0.0 | | body | string | The main text payload for the notification. | 1.0.0 | | id | string | The notification identifier. | 1.0.0 | | tag | string | The notification tag. Only available on Android (from push notifications). | 4.0.0 | | badge | number | The number to display for the app icon badge. | 1.0.0 | | notification | any | It's not being returned. | 1.0.0 | | data | any | Any additional data that was included in the push notification payload. | 1.0.0 | | click_action | string | The action to be performed on the user opening the notification. Only available on Android. | 1.0.0 | | link | string | Deep link from the notification. Only available on Android. | 1.0.0 | | group | string | Set the group identifier for notification grouping. Only available on Android. Works like threadIdentifier on iOS. | 1.0.0 | | groupSummary | boolean | Designate this notification as the summary for an associated group. Only available on Android. | 1.0.0 |

ActionPerformed

| Prop | Type | Description | Since | | ------------------ | ------------------------------------------------------------------------- | --------------------------------------------------------------- | ----- | | actionId | string | The action performed on the notification. | 1.0.0 | | inputValue | string | Text entered on the notification action. Only available on iOS. | 1.0.0 | | notification | PushNotificationSchema | The notification in which the action was performed. | 1.0.0 |

Type Aliases

PermissionState

'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'