MCPcopy Create free account
hub / github.com/clawbot7/cli-gateway / sendTextMessage

Method sendTextMessage

src/channels/feishu.ts:198–223  ·  view source on GitHub ↗
(params: { chatId: string; text: string })

Source from the content-addressed store, hash-verified

196 }
197
198 async sendTextMessage(params: { chatId: string; text: string }): Promise<void> {
199 const token = await this.getTenantAccessToken();
200
201 const res = await fetch(
202 'https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=chat_id',
203 {
204 method: 'POST',
205 headers: {
206 authorization: `Bearer ${token}`,
207 'content-type': 'application/json',
208 },
209 body: JSON.stringify({
210 receive_id: params.chatId,
211 msg_type: 'text',
212 content: JSON.stringify({ text: params.text }),
213 }),
214 },
215 );
216
217 const json = (await res.json()) as any;
218 if (!res.ok || json?.code) {
219 throw new Error(
220 `feishu send error: http=${res.status} code=${json?.code} msg=${json?.msg}`,
221 );
222 }
223 }
224}

Callers 1

createFeishuSinkFunction · 0.80

Calls 1

getTenantAccessTokenMethod · 0.95

Tested by

no test coverage detected