Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dmouse/google-bot
Wrapper to build the hangout chat payload
https://github.com/dmouse/google-bot
bot chat google hangout hangouts-chat
Last synced: 1 day ago
JSON representation
Wrapper to build the hangout chat payload
- Host: GitHub
- URL: https://github.com/dmouse/google-bot
- Owner: dmouse
- Created: 2019-05-22T18:54:38.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-05-23T20:15:44.000Z (over 5 years ago)
- Last Synced: 2024-11-11T06:29:50.499Z (about 1 month ago)
- Topics: bot, chat, google, hangout, hangouts-chat
- Language: PHP
- Homepage:
- Size: 7.81 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Google Hangouts Chat
Build the json payload to create or update messages using the Hangout Chat Webhooks
* [Official documentation](https://developers.google.com/hangouts/chat/reference/rest/v1/spaces.messages)
## Install
```$bash
composer require dmouse/google-bot
```## Objects
* Card
* Header
* Message
* Section
* Widget
* Markup\ActionParameter
* Markup\Button
* Markup\FormAction
* Markup\Icon
* Markup\Image
* Markup\KeyValue
* Markup\OnClick## Usage
```
key('key')
->value('val val')
;$form = FormAction::create()
->actionMethodName('form name')
->addParameter($param)
;$onClick = OnClick::create()
->openLink('http://go.com')
->action($form)
;$i = Image::create()
->imageUrl('http://image.com')
->aspectRatio(100)
->onClick($onClick)
;$button = Button::create()
->textButton('text button', $onClick)
->imageButton($onClick, 'name image button', Icon::BOOKMARK)
;$widget_a = Widget::create()
->textParagraph('text widget')
->image($i)
->addButton($button)
->keyValue(KeyValue::create()->topLabel("top label"))
;$s = Section::create()
->header('yay up1')
->addWidget($widget_a)
;$payload->text("sample text")
->name("My Name")
->createTime(time())
->previewText("preview text")
->fallbackText("fallback text")
->argumentText("argument text")
->thread("spaces/ABBAob4-eD8/threads/F3ZjK-OTJ3")->addCard(
Card::create()
->name("yay")
->header(
Header::create()
->title("yay")
->subtitle("Subtitle")
->imageUrl("http://example.com/...")
->imageStyle(Header::IMAGE_STYLE_AVATAR)
)
->addSection($s)
)
;print_r("" . $payload);
```