- alexa-api/: Echo デバイスに TTS を送る Node.js API サーバー
- server.js: alexa-remote2 を使わない直接 Alexa API 実装
- GET /api/language で CSRF トークン取得
- GET /api/bootstrap でカスタマー ID 取得
- POST /api/behaviors/preview で TTS 実行
- Dockerfile + docker-compose.yml: windmill_windmill-internal ネットワーク接続
- auth4.js: Amazon Japan OpenID フローで Cookie 取得(WORKING)
- scripts/alexa_speak.ts: Windmill から alexa-api を呼び出すスクリプト
Windmill (u/admin/alexa_speak) → alexa_api:3500/speak → Echo デバイス の
パスで日本語 TTS が動作することを確認済み。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
31 lines
843 B
TypeScript
31 lines
843 B
TypeScript
/**
|
||
* alexa_speak.ts
|
||
* 指定した Echo デバイスにテキストを読み上げさせる Windmill スクリプト
|
||
*
|
||
* パラメータ:
|
||
* device - デバイス名またはシリアル番号(例: "リビングエコー1", "プレハブ")
|
||
* text - 読み上げるテキスト
|
||
*/
|
||
|
||
export async function main(
|
||
device: string,
|
||
text: string,
|
||
): Promise<{ ok: boolean; device: string; text: string }> {
|
||
const ALEXA_API_URL = "http://alexa_api:3500";
|
||
|
||
const res = await fetch(`${ALEXA_API_URL}/speak`, {
|
||
method: "POST",
|
||
headers: { "Content-Type": "application/json" },
|
||
body: JSON.stringify({ device, text }),
|
||
});
|
||
|
||
if (!res.ok) {
|
||
const body = await res.json().catch(() => ({}));
|
||
throw new Error(
|
||
`alexa-api error ${res.status}: ${JSON.stringify(body)}`
|
||
);
|
||
}
|
||
|
||
return await res.json();
|
||
}
|