Last active
April 13, 2017 13:53
-
-
Save anoochit/276387a56d486d9a95a19bb534c23f68 to your computer and use it in GitHub Desktop.
linebot CarouselTemplateBuilder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$columns = array(); | |
$img_url = "https://cdn.shopify.com/s/files/1/0379/7669/products/sampleset2_1024x1024.JPG?v=1458740363"; | |
for($i=0;$i<5;$i++) { | |
$actions = array( | |
new \LINE\LINEBot\TemplateActionBuilder\PostbackTemplateActionBuilder("Add to Cart","action=carousel&button=".$i), | |
new \LINE\LINEBot\TemplateActionBuilder\UriTemplateActionBuilder("View","http://www.google.com") | |
); | |
$column = new \LINE\LINEBot\MessageBuilder\TemplateBuilder\CarouselColumnTemplateBuilder("Title", "description", $img_url , $actions); | |
$columns[] = $column; | |
} | |
$carousel = new \LINE\LINEBot\MessageBuilder\TemplateBuilder\CarouselTemplateBuilder($columns); | |
$outputText = new \LINE\LINEBot\MessageBuilder\TemplateMessageBuilder("Carousel Demo", $carousel); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment