How can I send a message to multiple agents

A user recently asked how to send the same message to multiple agents. Here are two different options:

  1. Since agents can share the same agent_name property, you could provide all of them with a common one, then address the message to that agent_name.

  2. You can also provide an array of strings to the to field when manually adding message objects (without the helper function). So you could call

state.messages.push({ 
  to: ["a", "b"], 
  type: "datetime", 
  data: {}
})

in a .js behavior to add multiple recipients to a message.