Created
April 5, 2020 10:24
-
-
Save monokaijs/d553940ef05ba05189f0560500b7f533 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include "ChatFramework/autoload.php"; // Include the right directory of autoload.php file in Framework's directory | |
$accessToken = "EAAml0vBnAw8BALzycHzdaADIwyKtG91p0hMzBtDFc7D5M6RqR6jEOOgo518bqc8gr9kv92y80cyIJdIo2Bp596YpDouU8BGr1XdHoFh2H0AoGqnPrzV9ZCVYZCfUC51JRGKuvM7cJm2vwQ3hVvXO1czaUHNiqwqH6xojsvvQZDZD"; | |
$bot = new \NorthStudio\ChatFramework($accessToken, false); | |
$builder = new \NorthStudio\MessageBuilder(); | |
$userId = $bot->getSenderId(); // ID cua nguoi gui tin nhan | |
$userInfo = $bot->getUserData($userId); // Thong tin co ban cua nguoi dung | |
$userMessage = $bot->getMessageText(); | |
if ($userMessage == "Xin chào!") { | |
$bot->sendMessage( | |
$userId, | |
$builder->createTextMessage("Chào bạn!") | |
); | |
} elseif ($userMessage == "Hi") { | |
$bot->sendMessage( | |
$userId, | |
$builder->createTextMessage("Hello.") | |
); | |
} else { | |
$bot->sendMessage( | |
$userId, | |
$builder->createTextMessage("Xin chào, {$userInfo['name']}. Chào mừng bạn đã đến với Page!") | |
); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment