<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-PP7S83N" height="0" width="0" style="display:none;visibility:hidden">
HACKATHON: Create cutting-edge enterprise apps using Retool + WeavyRead more
Guide

Prepare a Superblocks app for building Weavy components

This guide will help you prepare an existing Superblocks app with all the needed parts to use Weavy components with simple drag-n-drop!

1. Weavy API Key and backend

We need an API key to communicate with the Weavy backend.
 

2. Create a Weavy API Integration

We need to create a bridge between Weavy and Superblocks. We'll define a new WeavyAPI REST integration. This is where you securely can configure the server connection to the Weavy backend.

  • Open the integrations page in Superblocks and click Add integration.
  • Add a REST API.
  • Name the integration WeavyAPI. Make sure you get the name right as it will be referenced later.
  • Use WY_BACKEND_URL as Base URL, which is the url you your Weavy environment.
  • In Authentication, select Bearer Token.
  • Copy the masked API key below as the Token.
  • Add a Header with the key Content-Type and set the value to application/json.
  • Click Create to save the integration.
Weavy API Key
WY_API_*****************

3. Add app configuration variable

To prepare the app for Weavy Components, we need to configure the Weavy environment url in a Frontend variable in the App scope of your Superblocks app.

  • Open the Superblocks app you want to add Weavy Components to in edit mode.
  • Open the Navigation panel and add a temporary Frontend variable in the App scope.
  • Name the variable WEAVY_URL.
  • Set the Default value of the variable to WY_BACKEND_URL which is the url to your Weavy environment.

4. Clone the repo

The repo contains everything you need to set up and configure the demo app and a template for using Weavy as custom components in a Superblocks app.
Clone the repo
git clone https://github.com/weavy-labs/superblocks-weavy-components.git superblocks-weavy-components

5. Install dependencies

Change your directory to superblocks-weavy-components and run:

Install
npm install

6. Log in to Superblocks

The component repo is using the Superblocks CLI to work with the custom components. Log in to your Superblocks account.

Log in to Superblocks CLI
npx superblocks login

7. Install Weavy components in your app

Once you have your Superblocks authentication configured, you can run the create:components script to upload and configure the Weavy workflows.

During the installation you will have to deploy the created workflows to make them available for your apps. Just follow the instructions in the terminal to open the workflows in the browser and deploy them.

The installation will ask you which app to use and which pages to install to.

Run the script in the project root
npm run create:components

The script will automatically configure the following:

  • It creates a WeavyAuthentication workflow for user authentication token handling. The workflow is using the WeavyAPI you created.
  • It creates a WeavyPageNavigation workflow for saving page metadata that is needed by Weavy Notifications to be able to navigate back to the container their content originated from. The workflow is using the WeavyAPI you created.
  • It installs all the Weavy components in the app you have selected.
  • It creates a GetWeavyToken backend API in each page you have selected. The API is using the WeavyAuthentication workflow.
  • It creates a SetWeavyNavigation backend API  in each page you have selected. The API is using the WeavyPageNavigation workflow.
superblocks-workflow-deploy

8. Done!

Open your app and start adding Weavy components by just drag-n-dropping them onto your canvas from the Add components panel.

Start playing with the components and have a look at the other tutorials to add more features!

superblocks-app-v2
Ask AI
Support

To access live chat with our developer success team you need a Weavy account.

Sign in or create a Weavy account