googleapis / googleapis/google-api-nodejs-client
POST API call to Chat V1 messages not working
まだ誰も着手していません。
- 主要言語
- TypeScript
- スター
- 12.3k
- フォーク
- 2k
- 平均マージ
- 1日 9時間
- マージ済み PR(30日)
- 24
説明
Thanks for stopping by to ask us a question! Please make sure to include:
- What you're trying to do
Trying to follow documentation in how to request extra configurations to the user, I'm following the docs to use ActionResponse but when I use the client I get Error: Message cannot be empty. and if I try the API using fetch I get 400 Bad Request. Hoping I get this
but I'm not getting anything
- What code you've already tried
I've tried the following using the client
import { chat, auth } from '@googleapis/chat';
const googleAppAuth = new auth.GoogleAuth({
// Specify required scopes.
scopes: ['https://www.googleapis.com/auth/chat.bot'],
});
const chatAppClient = await chat({
version: 'v1',
auth: googleAppAuth,
});
chatAppClient.spaces.messages.create({
parent: space,
requestBody: {
actionResponse: {
type: 'REQUEST_CONFIG',
url: 'https://google.com',
},
},
});
and using raw api call:
const token = await googleAppAuth.getAccessToken();
console.log(await fetchEndPoint(`https://chat.googleapis.com/v1/${eventData.space?.name}/messages`, {
body: JSON.stringify({
actionResponse: {
type: 'REQUEST_CONFIG',
url: 'https://google.com',
},
}),
method: 'POST',
headers: {
Authorization: `Bearer ${token!}`,
},
}));
googleAppAuth is using ADC with the chat scope.
- Any error messages you're getting
PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされた ActionResponse ドキュメントから始め、chatAppClient.spaces.messages.create 呼び出しおよび POST /v1/{space}/messages の fetch 例と比較してください。報告されている「Message cannot be empty」と 400 の応答を再現し、その後、期待されるリクエストの動作を特定して、相違点を文書化するか解決してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- api
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 20/100