Telegram Bot,如何发送电话号码作为消息的链接

时间:2018-03-24 02:08:24

标签: laravel api bots telegram

我正在尝试发送带有电话号码的消息作为链接。有没有办法来实现呢?我正在使用Laravel Telegram Bot API

public function start( $telegram, $chatid ) {

        $keyboard = [
            ['Continue'],
        ];

        $reply_markup = Telegram::replyKeyboardMarkup([
            'keyboard' => $keyboard,
            'resize_keyboard' => true,
            'one_time_keyboard' => true
        ]);

        $text = "<b>¡Hola!</b> " . config('constants.emojis.waving-hand') .
            " Hey I'm Bot. " . config('constants.emojis.hug-face') .
            "\nPlease chose some option" .
            config('constants.emojis.glass') . "\nOr contact us at <a href='tel:018099999999'>HEREÍ</a> to talk with an specialist.";
        $this->sendMessage( $telegram, $chatid, $text, $reply_markup );

    }

此处还有我的发送消息功能

public function sendMessage( $telegram, $chatid, $text, $reply_markup ) {

    if ( !is_null( $reply_markup ) ) {

        $response = $telegram->sendMessage([
          'chat_id' => $chatid,
          'text' => $text,
          'parse_mode' => 'HTML',
          'reply_markup' => $reply_markup
        ]);

    } else {

        $response = $telegram->sendMessage([
          'chat_id' => $chatid,
          'text' => $text,
          'parse_mode' => 'HTML',
        ]);

    }

}

提前致谢。

1 个答案:

答案 0 :(得分:0)

您可以将电话号码与settings.pyplus代码一起使用:

<强> 98 9123456789

如果您使用该格式,电报会自动链接该号码!