Used NotificationProcessor for interview request notification
This commit is contained in:
parent
111d9094c8
commit
c6797c7738
@ -32,7 +32,7 @@
|
||||
"kartik-v/yii2-widget-datetimepicker": "dev-master",
|
||||
"edofre/yii2-fullcalendar-scheduler": "V1.1.12",
|
||||
"asmoday74/yii2-ckeditor5": "*",
|
||||
"kavalar/telegram_bot": "^0.1.0"
|
||||
"kavalar/telegram_bot": "0.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"yiisoft/yii2-debug": "~2.0.0",
|
||||
|
2392
composer.lock
generated
2392
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -6,6 +6,7 @@ use common\behaviors\GsCors;
|
||||
use common\classes\Debug;
|
||||
use common\models\InterviewRequest;
|
||||
use frontend\modules\api\models\ProfileSearchForm;
|
||||
use kavalar\BotNotificationTemplateProcessor;
|
||||
use kavalar\TelegramBotService;
|
||||
use yii\filters\auth\CompositeAuth;
|
||||
use yii\filters\auth\HttpBearerAuth;
|
||||
@ -71,12 +72,16 @@ class ProfileController extends \yii\rest\Controller
|
||||
$token = \Yii::$app->params['telegramBotToken'];
|
||||
$chat_id = \Yii::$app->params['telegramBotChatId'];
|
||||
|
||||
$message =
|
||||
"Пришёл запрос на интервью.\n".
|
||||
"Профиль: {$attributes['profile_id']}\n".
|
||||
"Телефон: {$attributes['phone']}\n".
|
||||
"Email: {$attributes['email']}\n".
|
||||
"Комментарий: {$attributes['comment']}";
|
||||
$templates = [
|
||||
'interview_request' =>
|
||||
"Пришёл запрос на интервью.\n".
|
||||
"Профиль: ~profile_id~\n".
|
||||
"Телефон: ~phone~\n".
|
||||
"Email: ~email~\n".
|
||||
"Комментарий: ~comment~"
|
||||
];
|
||||
$templateProcessor = new BotNotificationTemplateProcessor($templates);
|
||||
$message = $templateProcessor->renderTemplate('interview_request', $attributes);
|
||||
|
||||
$bot = new TelegramBotService($token);
|
||||
$bot->sendMessageTo($chat_id, $message);
|
||||
|
Loading…
Reference in New Issue
Block a user