A simple MessageSender implementing the API of chat services
MOVE FILES FROM THE "config" FOLDER TO THE "config" ROOT FOLDER
ADD THE FOLLOWING STROKES TO THE .env FILE:
TG_URL=https://api.Telegram.org
TG_TOKEN=
TG_CHAT_ID=
WA_URL=https://api.chat2desk.com
WA_TOKEN=
WA_CLIENT_ID=
MTS_URL=https://omnichannel.mts.ru
MTS_TOKEN=
MTS_LOGIN=
MTS_PASSWORD=
MTS_NAMING=
MTS_PHONE=
RUN IT ON THE COMMAND LINE AFTER FILLING IN THE FIELDS:
php artisan config:clear && php artisan config:cache
EXAMPLE:
/**
* Sends a message to a Telegram chat using the given token and chat ID.
*
* @param string $token The token is a string, like 110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw, which is required to authorize the bot and send requests to the Bot API. Keep your token secure and store it safely, it can be used by anyone to control your bot.
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param string|array|object $text The text or data to be sent as a message
* @return bool|mixed|string The response from the Telegram API, either as a JSON-decoded object or a string
*/
Shigabutdinoff\MessageSender\SendMessage::telegram(
token: config('telegram.token'),
chat_id: config('telegram.chat_id'),
text: 'text'
);