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::messageItem(message = paste("message", 1),
                     image = "https://adminlte.io/themes/v3/dist/img/user2-160x160.jpg",
                     from = "Divad Nojnarg",
                     time = "today",
                     color = "success") |>
  as.character() |>
  cat()