Мне удалось сравнить $_POST['Body']
с некоторыми функциями фильтра, вот мой полный код:
// You need to include Twilio library path here... for example require_once '/path/to/twilio-lib/autoload.php';
use Twilio\Twiml;
global $wpdb;
$response = new Twiml;
if (!empty($_POST))
{
$number = $_POST['From'];
$body = $_POST['Body'];
$default = "Hi " .$number. ", I'm a bot, please do not reply until you will get an update in some day. Have a nice day!";
$result = preg_replace("/[^A-Za-z0-9]/u", " ", $body);
$result = trim($result);
$result = strtolower($result);
//words to match and $result must be lowercase to define.
if ($result == 'stop' || $result == 'stopall' || $result == 'cancel' || || $result == 'end') || $result == 'quit' || $result == 'unsubscribe'{
//Your function to update database with $number
}
else if ($result == 'start' || $result == 'yes' || $result == 'unstop'){
$response->message('Thanks for re-subscribing');
//Your function to update database, again with $number
}
else {
$response->message($default);
}
print $response;
}