Is there a way to dynamically configure Actionable Notifications?

Hello,

We are trying to implement Actionable Notifications on iOS via Remote Notifications.

According to Apple’s official documentation (Declaring Your Actionable Notification Types), it is recommended to register notification categories at launch time.

However, in our use case, the number of buttons and their actions in the Actionable Notification are determined at the time of the Remote Notification request. This means that we cannot predefine the categories at app launch but need to dynamically configure them based on the payload of the Remote Notification.

Our Approach

We are considering setting aps.mutable-content = 1 and using Notification Service Extension to modify the categoryIdentifier dynamically. Below is the JSON payload we plan to use for Remote Notifications:

{
  "aps": {
    "alert": {
      "title": "New Message Received!",
      "body": "Check out the details."
    },
    "category": "DYNAMIC_CATEGORY",
    "mutable-content": 1
  },
  "categoryData": {
    "id": "DYNAMIC_CATEGORY",
    "actions": [
      {
        "id": "REPLY_ACTION",
        "title": "Reply",
        "options": ["foreground"]
      },
      {
        "id": "DELETE_ACTION",
        "title": "Delete",
        "options": ["destructive"]
      }
    ]
  }
}

Questions:

  1. Can we dynamically configure Actionable Notifications based on the Remote Notification payload?

  2. If we set categoryIdentifier in Notification Service Extension’s didReceive(_:withContentHandler:), will users still see the correct action buttons even if the app is terminated?

  3. What is the recommended approach to dynamically configure Actionable Notifications at the time of receiving the Remote Notification, rather than at app launch?

Is there a way to dynamically configure Actionable Notifications?
 
 
Q