Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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