typetalk-js aims to provide a complete, asynchronous client library for the Typetalk API.
For API details and how to use promises, see the JavaScript Promises.
typetalk-js is an unofficial library.
Typetalk - http://www.typetalk.in
Typetalk: Team discussions and collaboration through instant messaging.
Typetalk brings fun and ease to team discussions through instant messaging on desktop and mobile devices.
Support Promises
Use a polyfill script tag:
<script src="https://www.promisejs.org/polyfills/promise-5.0.0.min.js"></script>
The global variable Promise becomes available after the above script tag.
npm install typetalk-js --save
bower install typetalk-js --save
or clone the repository or just copy the files typetalk.js
or typetalk.min.js
to your server.
and then include it in your pages with <script src="typetalk.min.js"></script>
See also
var Typetalk = require('typetalk');
var typetalk = new Typetalk({
'client_id': 'YOUR_CLIENT_ID__CLIENT_CREDENTIALS',
'client_secret': 'YOUR_CLIENT_SECRET__CLIENT_CREDENTIALS',
'scope': 'topic.read,topic.post,topic.write,topic.delete,my'
});
var typetalk = new Typetalk({
'client_id': 'YOUR_CLIENT_ID__AUTHORIZATION_CODE',
'client_secret': 'YOUR_CLIENT_SECRET__AUTHORIZATION_CODE',
'redirect_uri': 'https://YOUR_APP_DOMAIN/provider_cb',
'scope': 'topic.read,topic.post,topic.write,topic.delete,my'
});
typetalk.getAccessTokenUsingClientCredentials().then(function(data) {
typetalk.accessToken = data.access_token;
typetalk.refreshToken = data.refresh_token;
}, function(err) {
console.error(err);
});
typetalk.getMyProfile().then(function(profile) {
console.log(profile);
});
typetalk.getMyTopics().then(function(topics) {
console.log(topics);
});
typetalk.postMessage(1657, {'message': '@shoito Hellow World!'}).then(function(message) {
console.log(message);
});
MIT License - http://opensource.org/licenses/MIT