Botman: How to send message to multiple users at once?

Created on 17 Dec 2017  路  4Comments  路  Source: botman/botman

  • BotMan Version: 2.1.5
  • PHP Version: 7.1.1
  • Messaging Service(s): Telegram
  • Cache Driver: Laravel

Description:

In documentation in "Originating Messages" section it is stated that

BotMan also allows you to send messages to your chat users programatically. You could, for example, send out a daily message to your users that get's triggered by your cronjob.

Is it possible to send message to several users at once? (I tried this code it doesn't work)

Botman::say($request->message, Subscriber::pluck('id_in_telegram')->toArray(), TelegramDriver::class);

or I need to send message to each user separately? (this code works)

foreach (Subscriber::pluck('id_in_telegram') as $subscriberId) {
    Botman::say($request->message, $subscriberId, TelegramDriver::class);
}

Most helpful comment

Hey,

you're right - the say method didn't accept an array until now. I just published 2.1.6 which adds support for this.

All 4 comments

Hey,

you're right - the say method didn't accept an array until now. I just published 2.1.6 which adds support for this.

Hello @mpociot.
How many users can be sent at once?

hey @niksib , this will probably depend on the driver. There is no limit in BotMan itself.

@christophrumpel Thanks.

Was this page helpful?
0 / 5 - 0 ratings