Cordova Action Buttons

Configuring Action Buttons

When creating mobile push notifications, you can add action buttons.

  • iOS supports up to 4 buttons in one notification.
  • Android supports up to 3 buttons in one notification.

Adding Action Buttons

  1. In Yespo, open Messages -> Mobile Push.
  2. Create a push or edit existing one.
  3. Configure the Buttons section.

Use unique Action ID values for different buttons.

ParameterNotes
Action IDUnique button action identifier
TextText shown on the button
iOS icon pathAvailable on iOS 15+. Name of image from app bundle
Launch URLURL/deeplink to open
Custom dataAdditional JSON payload

Handle Action Button click

Enable handler for iOS event emission:

await RetenoPlugin.setNotificationActionHandler({ emitEvent: true });

Subscribe:

function onPushButtonClicked(event) {
  const detail = event && event.detail !== undefined ? event.detail : event;
  console.log('reteno-push-button-clicked:', detail);
  // detail.actionId
  // detail.link
  // detail.customData
  // detail.userInfo
}

RetenoPlugin.setOnRetenoPushButtonClickedListener(onPushButtonClicked);

// later
RetenoPlugin.removeOnRetenoPushButtonClickedListener(onPushButtonClicked);

Disable handler:

await RetenoPlugin.setNotificationActionHandler(false);

Android note: setNotificationActionHandler(...) is no-op on Android. Action button clicks are detected automatically.