Build an app with Lovable
Connect Lovable to Relynk with a custom connector, share the connection, and build an app on your building data by describing it.
Set up a Relynk connector in Lovable once, connect your Relynk account to it, and then build apps on your building data by describing them in Lovable's chat.
A connector is how Lovable talks to another service. Lovable signs you in to Relynk, keeps the sign-in safe on its own servers and adds it to every request, so it never appears in your chat or in the app's code.
What others can see
A Relynk connection shows the data of the Relynk account that connected it. Everyone who uses the app, and everyone the connection is shared with, sees what that Relynk account can see. Connect with a Relynk account that has access to only what the app should show.
Before you start
- Lovable: to create the connector you must be an admin or owner of the Lovable workspace. Other members only connect to it (part 2).
- Relynk: an account with access to the buildings the app should show.
- From your Relynk contact: the OAuth client ID and client secret for Lovable.
- Client ID: ask your Relynk contact for it.
- Client secret: Relynk sends it to you privately. Never paste it into a Lovable chat, a prompt or the app's code.
Part 1: Create the Relynk connector
A workspace admin or owner does this once for the whole workspace. The form has four sections, Details, Authentication, Data and Agent knowledge, and you fill them in from top to bottom. Every value below has a copy button: copy it and paste it into the field with the same name.
Open the form
In Lovable, open Connectors, select + in the top right, then select Custom connector ("Connect an API to your workspace"). The Create custom connector form opens.
Details
Open Details and fill in:
RelynkBuilding data from Relynk: buildings, rooms, sensors and energy use.Read-only access to Relynk building data: buildings, rooms and equipment, sensor readings over time, and energy, water and waste consumption.Logo (optional): download the Relynk icon below (relynk-icon-512.png), then select Upload logo and choose the file.
Category: select Other.
https://learn.relynk.io/docs/builder/lovableAuthentication
Open Authentication. Under Method, select OAuth 2.0, then fill in:
https://auth.relynk.io/authorize?audience=https%3A%2F%2Fai.relynk.io%2Fbuilderhttps://auth.relynk.io/oauth/tokenopenid
offline_access- Scope separator (optional): leave it empty.
- Use PKCE: turn it on.
The Authorization URL ends with ?audience=… on purpose: it tells Relynk's sign-in which API the
sign-in is for (https://ai.relynk.io/builder). Without it, signing in works but every request fails
with 401.
Below Use PKCE the form shows Add this redirect URL to the service's OAuth app settings. It should read:
https://api.lovable.dev/workspaces/connectors/standard/oauth/callbackRelynk has already allowed this address, so there is nothing to do. If your form shows a different address, send it to your Relynk contact before you connect (part 2).
Further down in Authentication, fill in:
https://ai.relynk.io/builder/v1Under Test request, leave Method on GET and enter:
/meA connector cannot switch between OAuth 2.0 and another method later. If you chose the wrong method, delete the connector and create it again.
Data
Open Data and select Personal data ("In chat, only the person who connected can use it").
Relynk shows each person what their own Relynk account may see, so in Lovable's chat everyone should use their own connection. Apps still use the connection linked to them; see What others can see.
Agent knowledge
Knowledge files teach Lovable how to use Relynk. Add all seven, in this order. For each file, copy the Name, the Description and the Content into the fields with the same name:
Use the empty knowledge file the form starts with.
Relynk guideHow the Relynk API works: the data model, choosing a tenant, errors and limits, and the rules that keep the numbers right. Read it before any Relynk call.Content: select Copy content and paste it into Content. (relynk-guide.md)
Open fileSelect Add knowledge file first.
Relynk buildingsListing the tenant's buildings and their ids, the starting point for most other Relynk calls.Content: select Copy content and paste it into Content. (relynk-functions-buildings.md)
Open fileSelect Add knowledge file first.
Relynk resource typesLooking up type keys (rooms, equipment, kinds of sensor) and the relationships a building uses, before filtering resources or points by type.Content: select Copy content and paste it into Content. (relynk-functions-resourceTypes.md)
Open fileSelect Add knowledge file first.
Relynk resourcesFinding levels, rooms and equipment in a building and walking the relationships between them.Content: select Copy content and paste it into Content. (relynk-functions-resources.md)
Open fileSelect Add knowledge file first.
Relynk points and time seriesFinding sensors, setpoints and meter points and reading their latest values, time series, summaries and raw readings for charts and tables.Content: select Copy content and paste it into Content. (relynk-functions-points.md)
Open fileSelect Add knowledge file first.
Relynk metersListing EOS energy, water and waste meters, and which meters are sub-meters of which.Content: select Copy content and paste it into Content. (relynk-functions-meters.md)
Open fileSelect Add knowledge file first.
Relynk consumptionEnergy, water and waste consumption and cost per building or per meter, with data quality, for energy dashboards and reports.Content: select Copy content and paste it into Content. (relynk-functions-consumption.md)
Open fileThe files hold no credentials and no addresses, and together they are well under Lovable's limits (50 files per connector, 50,000 characters each, 256 KB in total).
Create
Select Create. Relynk now appears in the workspace's connector catalog.
Part 2: Connect your Relynk account
Each person who builds with Relynk data does this once.
Add a connection
Open Connectors, find Relynk, and select Add connection.
Enter the client ID and secret
ask your Relynk contact for itClient secret: your Relynk contact sends it to you privately. Enter it only in this form, never in a chat, a prompt or the app's code.
Sign in to Relynk
A window opens with Relynk's sign-in. Sign in with the Relynk account whose data you want to build with.
Choose who can use the connection
Under Sharing, choose who may use it: only you (the default, shown as Private), specific people, or the whole workspace. Everyone you share with sees what your Relynk account can see.
Check the connection
Lovable sends the test request (GET /me). When it succeeds, the connection is ready. If it
fails, see Troubleshooting.
Link it to your project
Link the connection to the Lovable projects that should use Relynk data.
Lovable encrypts the client secret and your sign-in and adds them to requests on its own servers. They never appear in the chat or in the project's code.
Part 3: Build your app
Start a project, link the Relynk connection, and paste this as your first prompt. Replace the last line with what you want to build.
Build an app on my Relynk building data, using the Relynk connector for every Relynk request.
Before writing code, read the Relynk knowledge files, starting with "Relynk guide".
Start with GET /me. If it lists more than one tenant, let me choose one and add ?tenantId=<id> to every request.
Look up type keys with resourceTypes.list instead of guessing them.
Show null as missing data, never as 0, and show times in Europe/Oslo.
What I want: <describe your app>Example prompts
- "Show a dashboard of room temperatures in my building."
- "Chart the hourly temperature of every room on level 2 for the last week."
- "List the five warmest and the five coldest rooms last month."
- "Show electricity, heating and water use per month this year, with the data quality next to each number."
- "Make a page where I pick a building and see its rooms, equipment and sensors."
Ask for one thing at a time, check it, then ask for the next.
What others can see
- Everyone using the app sees the data of the Relynk account that connected, whether they have a Relynk account themselves or not. Put the app behind Lovable's own login if the data should not be public.
- Everyone the connection is shared with can build apps with that same data.
- Use a Relynk account with access to only the buildings the app should show. Your Relynk contact can set one up.
Troubleshooting
The connector form shows a redirect URL that Relynk has not allowed. Copy it from Authentication in the connector form and send it to your Relynk contact. It must match character for character.
The sign-in is not for the Relynk API. Check that the Authorization URL is exactly
https://auth.relynk.io/authorize?audience=https%3A%2F%2Fai.relynk.io%2Fbuilder, including everything after the ?. If it is and the
test still fails, tell your Relynk contact.
Your Relynk account has no access to any tenant. Ask your Relynk contact to give it access to the buildings the app should show.
The app asked for a tenant your Relynk account cannot read. Ask Lovable to call GET /me and use
one of the tenants it lists.
Your account can read more than one tenant. Ask Lovable to let you choose one from GET /me and
add ?tenantId=<id> to every request.
The app made too many requests at once or in a short time. Ask Lovable to make Relynk requests one after another, to wait as long as the response says before trying again, and to keep results it already has instead of asking again.
Ask Lovable to follow the "Relynk guide" knowledge file: missing data is null and must show as
missing, never as 0, and energy totals come from consumption.buildings, never from adding meters
together.


