linemob / bot-translation

0 stars 5 forks source link

Besides ngrok #1

Open winbotscript opened 7 years ago

winbotscript commented 7 years ago

Hai, sorry can i use Besides ngrok etc : hosting or vps ???

liverbool commented 7 years ago

Absolutely you can!, just place code into your controller.

// https://symfony.com/doc/current/controller.html
function someAction(Request $request) {
    $config = [....];
    $receiver = Setup::demo($config);
    $signature = $request->headers->get('X-Line-Signature');

    if ($receiver->validate($request->request->all(), $signature)) {
        $receiver->handle($data);
        return new Response('OK');
    } else {
        return new Response('Oops!, Something Wrong');
    }
}

sorry for lack doc ;) will be soon.

PS. i just have updated core lib to dev-master, please check https://github.com/linemob/bot-translation/blob/1dc574ba6c604323f3e58317c1b83f3fef78e3ac/src/Middleware/TranslateMiddleware.php#L56-L70 example to create command->message.

liverbool commented 7 years ago

If you're interested more change in dev-master see https://github.com/linemob/core/pull/2