send_message() public method

public send_message ( $params )
function dicebot($info)
{
    $obj = arr2obj($info);
    /* username to send reply to */
    $to_username = $obj->notifo_from_username;
    /* compute response here */
    $msg = strtolower($obj->notifo_message);
    $arr = explode(" ", $msg);
    $commands_arr = array("flip", "help", "hi", "hello");
    $command = strtolower($arr[0]);
    if (!in_array($command, $commands_arr)) {
        /* invalid command, tell them to send help for info */
        $message = "Send the command 'help' for more info.";
    } else {
        if ($command == "flip") {
            $coins = array("Heads", "Tails");
            $flip = mt_rand(0, 99);
            if ($flip < 50) {
                $flip = 0;
            } else {
                $flip = 1;
            }
            $message = "You flipped a coin: " . $coins[$flip] . ".";
        } else {
            /* sent help, hi, or hello */
            $message = "Hello, send the command 'flip' to flip a coin!";
        }
    }
    $notifo = new Notifo_API(NOTIFO_SERVICE_USERNAME, NOTIFO_APISECRET);
    $notifo->send_message(array("to" => $to_username, "msg" => $message));
}