Expand description

Google Chat Types

About Google Chat Message

type helper for construct Google Chat message There two type of Google Chat message

  • Text Message
  • Card Message

they are all represented as a json string.

Text Message represented like

{
    "text":"some text"
}  

Card Message represented like

{
 "cards": [
    {
      "sections": [
        {
          "widgets": [
            {
              "image": { "imageUrl": "https://..." }
            },
            {
              "buttons": [
                {
                  "textButton": {
                    "text": "OPEN IN GOOGLE MAPS",
                    "onClick": {
                      "openLink": {
                        "url": "https://..."
                      }
                    }
                  }
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

the relationship between elements of cards should looks like below

How to use this crate

you should construct Cards or Text struct, then serialize them to json string as a Google Chat API(for instance incoming webhook) http request body.

Structs

Builder for Button.

the Card response. construct this by call default() method of this type

Builder for Card.

The Card message type

Builder for Cards.

Builder for Header.

Builder for Image.

Builder for OnClick.

Builder for Section.

The Text message type

Builder for Text.

Builder for Widget.