//native
/**
* Get Message
* Get one Chat message (sender, text, thread, attachments, create/update time) by its resource name `spaces/{space}/messages/{message}`, as returned by List Messages or Send Message. Requires chat.messages.readonly or chat.messages on the connection (not in the default scopes).
*/
export async function main(auth: RT.Gchat, message_name: string) {
const response = await fetch(`https://chat.googleapis.com/v1/${message_name}`, {
headers: {
Authorization: `Bearer ${auth.token}`,
Accept: "application/json",
},
})
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 6 hours ago