GithubHelp home page GithubHelp logo

ericwylie / hangoutschatwebhook Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mikedopp/hangoutschatwebhook

0.0 1.0 0.0 286 KB

Commands to interact with the Google Hangouts Chat webhooks.

PowerShell 100.00%

hangoutschatwebhook's Introduction

Google Hangouts Chat Webhook Module

This module is designed to make it quick and easy to send messages via Google Hangouts Chat's Webhook feature. There are two kind of messages that can be sent via Webhook: Text and Cards

  • Text: These messages are simple, they can include markdown style formatting for bold, italic, and strike-through styles. You can include line breaks as well.
  • Cards: These messages are complex. They are constructed out of many items that build a Google style card with information. They can include inline images, can be broken up in to sections, and can contain hyperlinks. In the text, HTML is supported.

For more information on the types of widgets that can exist in a Card, check the Hangouts Chat API Reference

Current Features

  • Simple text message sending.
  • Basic Card Functionality.

Simple Text Example

Sending a simple text message is... simple! You can include line breaks and text formating using Hangout Chats markdown style syntax.

$URI = "https://chat.googleapis.com/..."

$Text = "*Alert! Please read.*
This is a sample message with formating"

$Message = New-GHCTextMessage -Message $text

Send-GHCWebhookMessage -URI $URI -Message $Message

Card message example

Sending a Card message utlizes a number of cmdlets nested together to build the card of your liking. Here is a recreation of the JSON example on the Google Hangouts Chat API documentation.

$uri = "https://chat.googleapis.com/..."

$message = New-GHCCardMessage -Content {
    New-GHCCardHeader -Title "Pizza Bot Customer Support" -Subtitle "[email protected]" -ImageURL "https://goo.gl/aeDtrS" -ImageStyle avatar
    New-GHCCardSection -Content {
        New-GHCCardWidget -Content {
            New-GHCWidgetKeyValue -TopLabel "Order No." -Content "12345"
            New-GHCWidgetKeyValue -TopLabel "Status" -Content "In Delivery"
        }
        New-GHCCardWidget -Header "Location" -Content {
            New-GHCWidgetImage -URL "https://maps.googleapis.com/..."
        }
        New-GHCCardWidget -Content {
            New-GHCWidgetTextButton -text "OPEN ORDER" -onclickurl "https://example.com/orders/..."
        }
    }
}

Send-GHCWebhookMessage -URI $uri -Message $message

When creating a card message follow the naming convention. New-GHCCard... items nest under New-GHCCardMessage, New-GHCWidget... items nest under the New-GHCCardWidget. All Widgets must fall under a Section and every card message must have at least one Section.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.