silent-echo-sdk
v0.3.8
Published
[](https://circleci.com/gh/bespoken/silent-echo-sdk) [](https://codecov.io/gh/bespoken/silen
Downloads
60
Readme
Silent Echo SDK
Use the Silent Echo SDK to build UIs and bots that interact with Alexa via text.
Check out our first example project to use it - SilentEchoBot!
Add SilentEcho to your Slack - try it here.
The SDK can be used via NodeJS or HTTP.
NodeJS SDK
Installation
Add the Silent Echo SDK to your project:
npm install silent-echo-sdk --save
Get your token:
https://silentecho.bespoken.io/link_account?token=true
Save the token that is generated - you will use it in the step below.
Sending a Message
Here is a simple example in Javascript:
const echoSDK = require("silent-echo-sdk");
const silentEcho = new echoSDK.SilentEcho("<PUT_YOUR_TOKEN_HERE>");
silentEcho.message(message).then((result) => {
console.log("Reply Transcript: " + result.transcript);
console.log("Reply Audio: " + result.transcript_audio_url);
});
Result Payload
Here is the full result payload:
export interface ISilentResult {
card: ICard | null;
debug?: {
rawJSON: any;
};
sessionTimeout: number;
streamURL: string | null;
transcript: string;
transcriptAudioURL: string;
}
export interface ICard {
imageURL: string | null;
mainTitle: string | null;
subTitle: string | null;
textField: string;
type: string;
}
HTTP SDK
The SilentEcho service can also be called directly via HTTP.
Pre-Requisites
Get a SilentEcho Token:
https://silentecho.bespoken.io/link_account?token=true
Save the token - you will use it when call the HTTP interface.
Requests
The Base URL is:
https://silentecho.bespoken.io
- /process
- Method: GET
- Parameters:
- user_id: string - SilentEcho token
- message: string - The message to send to Echo
- debug: string [Optional] - If set, returns debug output
- Response:
- Status: 200 (If successful)
- Payload: JSON conforming to this description
Example
HTTP Request:
https://silentecho.bespoken.io/process
?user_id=<TOKEN>
&message=hello there
HTTP Response:
{
"card": null,
"sessionTimeout": 0,
"streamURL": null,
"transcript": "hi",
"transcriptAudioURL": "https://storage.googleapis.com/raw_audio/7898e6fb-2d3d-4039-9b4a-00641fa1c249.mp3"
}
What's Next
- Keep the session open longer for deep skill interactions
- More bots. Lots of 'em.