-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample.php
More file actions
45 lines (31 loc) · 1.6 KB
/
example.php
File metadata and controls
45 lines (31 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
require_once 'vendor/autoload.php';
$guzzle = new \GuzzleHttp\Client();
$webhooks = [
'default' => 'https://chat.googleapis.com/v1/spaces/AAAAK4AL5Bg/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=3PPfdSFIA_p3ColcvumRTiRnbMftokJhDjz0RJI3sa8%3D'
];
$sender = new \Junisan\GoogleChat\GoogleChatSender($guzzle, $webhooks);
$message = new \Junisan\GoogleChat\SimpleMessage();
$message
->addText('Hola')
->addLine()
->addBoldText('Como estás')
->addLine()
->addLink('https://www.juannicolas.eu');
$sender->send($message, 'default');
$link = \Junisan\GoogleChat\UIElements\TextButton::create('http://google.es', 'Follow');
$link2 = \Junisan\GoogleChat\UIElements\TextButton::create('http://google.es', 'Unfollow');
$link3 = \Junisan\GoogleChat\UIElements\ImageButton::create('http://google.es', 'https://goo.gl/aeDtrS');
$order = \Junisan\GoogleChat\UIElements\KeyValue::create('Order No.', '12345');
$status = \Junisan\GoogleChat\UIElements\KeyValue::create('Status', '12345');
$textParagraph = \Junisan\GoogleChat\UIElements\TextParagraph::create('Hola');
$sectionA = \Junisan\GoogleChat\Elements\Section::create()
->addWidgets($order, $status, $textParagraph, $link3);
$sectionB = \Junisan\GoogleChat\Elements\Section::create()
->addWidgets($link, $link2);
$card = \Junisan\GoogleChat\Elements\Card::create('Pizza __Bot__', 'pizzabot@example.com', 'https://goo.gl/aeDtrS')
->addSections($sectionA, $sectionB);
$cardB = \Junisan\GoogleChat\Elements\Card::create('Hola');
$message = \Junisan\GoogleChat\Message::create()
->addCard($card);
$sender->send($message, 'default');