oh-sky / line-trialbot
Requests and Response Handler for Line TrialBot API
1.1.0
2016-04-21 16:01 UTC
Requires
- php: >=5.5
- guzzlehttp/guzzle: ~6.0
Requires (Dev)
- phpunit/phpunit: 4.*
This package is not auto-updated.
Last update: 2024-12-19 01:15:53 UTC
README
Install
composer require oh-sky/line-trial-bot-sender
Usage
<?php
namespace Foo;
include 'vendor/autoload.php';
use OhSky\LineTrialBot\Sender;
use OhSky\LineTrialBot\RequestHandler;
$sender = new Sender(
YOUR_CHANNEL_ID,
YOUR_CHANNEL_SECRET,
YOUR_CHANNEL_MID
);
$requestBodyJson = file_get_contents('php://input');
$eventList = RequestHandler::getEventList($requestBodyJson);
foreach ($eventList as $event) {
// Sending TEXT
$sender->sendText(
[$event->content->from],
"text to send"
);
// Sending Image
$sender->sendImage(
[$event->content->from],
'IMAGE_URL',
'THUMBNAIL_URL'
);
// Sending Video
$sender->sendVideo(
[$event->content->from],
'VIDEO_URL',
'THUMBNAIL_URL'
);
// Sending Audio
$sender->sendAudio(
[$event->content->from],
'AUDIO_URL',
'AUDIO_LENGTH_MILLI_SECOND'
);
// Sending Location
$sender->sendLocation(
[$event->content->from],
'TEXT',
'TITLE',
latitude, //float
longitude //fload
);
// Sending Sticker
$sender->sendSticker(
[$event->content->from],
'STICKER_ID',
'STICKER_PACKAGE_ID',
'STICKER_VERSION'
);
}