docomochatter
v0.1.0
Published
Docomo Zatsudan API Client
Downloads
1
Readme
docomochatter
Docomo Zatsudan(雑談) API Client.
Requirement
- Node v0.12 or more
- Docomo API key (Get it here)
Usage
Set docomo API key to the environment variable, DOCOMO_API_KEY
, then instantiate the object and call create_dialogue()
with your message. create_dialogue()
returns Promise, so you can chain methods by using .then()
and .catch()
.
var Docomochatter = require('docomochatter');
client = new Docomochatter(process.env.DOCOMO_API_KEY);
client.create_dialogue('hello').then(function(response){
console.log(response.utt);
}).catch(function(error){
console.log(error);
});
via CoffeeScript
Docomochatter = require('docomochatter')
client = new Docomochatter(process.env.DOCOMO_API_KEY)
client.create_dialogue('hello')
.then (response) ->
console.log response.utt
.catch (error) ->
console.log error
Sample API response
{ utt: 'はろー',
yomi: 'はろー',
mode: 'dialog',
da: '30',
context: 'mnqsaABy9i7ByZBB6QxU9Q' }