Speakap JS library
Speakap utilities for server and browser application parts.
Speakap API node client
Includes methods for signed request verification along with the API client utilities.
Setup example
const Speakap = require("speakap/server");
const speakapApi = new Speakap.API({
baseUrl: process.env.API_HOST,
appId: process.env.APP_ID,
appSecret: process.env.APP_SECRET,
apiVersion: process.env.API_VERSION || "1.6.1"
});
Usage examples
speakapApi
.get(`/networks/${networkId}/user/${userId}/`))
.then(response => {
// do something with response
})
.catch(error => {
// handle error
});
speakapApi
.post(`/networks/${networkId}/messages/`, {
body: "test 123",
messageType: "update",
recipient: { type: "network", EID: networkId }
})
.then(response => {
// do something with response
})
.catch(error => {
// handle error
});
Speakap browser utilities
Setup
const createSpeakapFeBridge = require("speakap/frontend");
const frontendBridge = await createSpeakapFeBridge({
appId: "YOUR_APP_ID",
signedRequest: "SIGNED_REQUEST_PARAMS"
});
Please note: This library makes use of modern ES6 features. If you need it to work in browsers without support for this, please make sure to use Babel and/or provide the necessary polyfills.
Usage example
frontendBridge.showNotice("Hello from my app!");
License
The Speakap JS library is made available under the MIT license.