0
msgService := chat.NewSpacesMessagesService(service)
    msg := ChatCard("Title", "Subtitle", data)
    // msg := "hello"
    fmt.Print("Now ChatCard Method called\n")
    _, err = msgService.Create("spaces/AAAAwlgqHZg", msg).Do()
    if err != nil {
        fmt.Println(err)
    }

I'm going to connect to google chat But a google API error occurs, Any help would be appreciatable?

Peter
  • 29,454
  • 5
  • 48
  • 60
  • Hi, please let me know if my answer helped. If this answered your question you can [accept the answer](https://stackoverflow.com/help/accepted-answer) so this can help other people in the community who may have the same concern as you. – Daniel Jul 28 '22 at 00:17

1 Answers1

0

Short answer: You need to go to your GCP project's Chat API configuration page to fill out the Application info and then publish it.

Long answer: The error message 404: "No bot associated with this project." is mentioned in Google's issue tracker here. The explanation is that you need to first configure your "bot". The point is that the Chat API methods act through chatbots. These show up in the rooms with the BOT tag and the API works as if the bots are users performing the actions.

enter image description here

Nowadays Google has changed their wording and they no longer refer to this as a "bot", now it's simply referred to as "app", but for all intents and purposes the process is the same. You need to go to the Chat API's configuration page in your GCP project to establish its name, avatar image, etc.

enter image description here

The app also needs to be published to the Google Workspace Marketplace either publicly or for your domain's users so they can interact with it. I recommend you check out their full documentation:

Daniel
  • 3,157
  • 2
  • 7
  • 15