@hopin.com/integrations-sdk
v0.5.2
Published
Javascript SDK for built in-event apps on Hopin
Downloads
34
Readme
Hopin Integrations SDK
Build apps on Hopin. Grow your business.
The Integrations SDK gives you, the developer, a way to build apps using common web technologies which can interact with parts of Hopin not otherwise exposed via our public APIs. In practical terms, that means being able to read and control state which only exists within the browser.
The SDK is currently an invite-only program. For further details and to express your interest, please visit https://hopin.com/developers.
Geting Started
Add the NPM package to your project (npm i @hopin.com/integrations-sdk
), then:
import { connectToHost } from '@hopin.com/integrations-sdk';
// Setup the SDK (only do this once)
const sdk = await connectToHost();
// sdk.user is a SyncMapItem, we can retrieve it directly...
const user = sdk.user.get();
// ... and listen changes to it's value
sdk.user.listen(updatedUser => {
console.log(updatedUser);
});
// We can also invoke methods that affect behaviour in Hopin.
await sdk.media.mute();
Async Methods
All methods called on an instance of the SDK are async -
// If we care about success/error or need a return value, we must await the result.
await sdk.media.mute();
// or equivalently using Promises
sdk.media.mute().then(() => {
// done
})
SyncMapItem
Where data is exposed into your app from Hopin, it is provided via an instance of SyncMapItem
. This wrapper
boxes the underlying value with some methods which make it easier to listen to updates over time. It's interface is simple:
const user = sdk.user;
user.get(); // Retrieves the current user.
user.listen(updatedUser => {
// Our callback is fired with the latest value each time the user is updated.
});
Sandboxing
Apps run within Hopin inside a iframe
which is sandboxed. In practice, this is similar to fairly strict Content Security Policy - your app will not have access to many browser APIs. At the time of writing, these include:
- Cookies & Local/Session Storage
window.open
- Synchronous modals (
alert
/confirm
etc) - Form submissions
- File downloads
- Pointer Lock
- PresentationRequest
More Docs
Further documentation is currently provided within the package (see the docs
) folder.
Other Useful Packages
We strive to maintain impartiality from view libraries in this package, however if you're using React, you may find @hopin.com/integrations-sdk-react
useful.