insertUI Example Code

library(shiny)
library(bs4Dash)

ServerFunction = function(input, output, session) {
  
  observeEvent(input$add, {
    insertUI(
      selector = ".dropdown-menu > .dropdown-item .dropdown-header",
      where = "afterEnd", #After the selector element itself
      ui = messageItem(
        message = paste("message", input$add),
        image = dashboardUserImage,
        from = "Divad Nojnarg",
        time = "today",
        color = "success"
      )
    )
  })
}
bs4Dash::dropdownMenu(badgeStatus = "danger",
                      type = "messages") |>
  as.character() |>
  cat()