Step 2: Embed your FileFeed Builder
Generate a Code Snippet
- On OneSchema's admin dashboard, navigate to the
Embedding FileFeeds
section on theFileFeeds
tab. - You can choose an existing
FileFeed
as long as thetemplate
attached the theFileFeed
has been pushed to the chosen environment. An environment controls which version of a template is used and which environment variables are passed to webhooks. - Embeddable FileFeeds currently supports Javascript, React, Angular, Vue SDKs
- If relevant, install the appropriate package using
npm
oryarn
Authentication
- For authenticating your users, you will need to generate a OneSchema JWT token that is signed by a OneSchema
client_secret
. - The Admin dashboard will give you a signed OneSchema JWT in your code snippet, but in production, you will have to generate these on your backend.
Receiving events
- For receiving events from your FileFeed runs when files have errors or files are successful, you will need to create an event webhook and attach the
event_webhook_key
.
Launch the code snippet
- Paste the code snippet into your application and click the "Launch" button to launch the OneSchema Embedded FileFeed Builder.
Resuming sessions
- Each FileFeed Embedded builder corresponds to a
session
. The code snippet page behavior instantiates a new session. By using thesession token
associated with an existing session token, we can re-join an existing session. - There are two ways to retrieve a session token.
- When creating a
session
via our external api, the session token is exposed on the success payload. - When we create a
session
via thesdk
thesession token
, is returned on theinit-succeeded
payload.
- When creating a
- A session token can be passed as an initialization param in the
sdk
. It can be passed either at init as aFileFeedParam
or at launch as aFileFeedLaunchParam
When a session token is provided, the session token is validated against the providedjwt
. A session token overrides all other FileFeed params as it restores the state of the existing session. - There is auto-resume behavior built into the FileFeed embedding, meaning that session_token is automatically saved and the SDK will resume the session if it was not closed through normal means (e.g., browser closing or refreshing). However, the session will not resume if the user Cancels it or if they hit the Save button, or if for any other reason the session goes invalid (such as changes to the FileFeed from the dashboard or other embed sessions).
Updated about 1 month ago
What’s Next