google-chat-types

Crates.iogoogle-chat-types
lib.rsgoogle-chat-types
version0.1.5
sourcesrc
created_at2022-06-12 08:30:51.10707
updated_at2022-06-13 03:57:43.041079
descriptiontypes collection of google chat response
homepage
repositoryhttps://github.com/sinyo-matu/google-chat-types
max_upload_size
id604499
size55,448
Yang Qin (sinyo-matu)

documentation

README

Google Chat Types

type helper for construct Google Chat message

About 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

Alt text

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.

Commit count: 9

cargo fmt