Multichannel allows you to send message via Viber and in case recipient does not own Viber account, SMS message will be send instead.
$phone_number = new PhoneNumber('420777777777', 'cz');
$text = new SimpleText('test <variable>', ['variable' => 'message']);
$button = new Button('Caption', 'url');
$image = new Image('image url', false);
$timeout = 5;
$message = new MultiChannel($phone_number);
$message->sms($text, 'gText', 'Sender', false);
$message->viber($text, 'Sender', $button, $image, $timeout);
$this->sender->send($message);
You can also change the settings of individual channels after the fact
$message->configure(Channel::SMS, $sender_id, $sender_id_value, $unicode);
$message->configure(Channel::VIBER, 'sender', $button, $image, $timeout);
Based on used settings interface method channel can be used.
$settings = new \BulkGate\Sdk\Message\Settings\Viber(new SimpleText('text_message'), 'sender', $button, $image, $timeout);
$message->channel($settings);
You can use method setPrimaryChannel
to set channel priority
$message->setPrimaryChannel(Channel::VIBER);