Using Kirora from a Lovable appMenu
On this page

Using Kirora from a Lovable app

Add Kirora to Lovable as a custom connector, with the knowledge files that teach it to identify contacts, track events and send transactional email.

View as MarkdownOpen in ClaudeOpen in ChatGPTUpdated

An app you build with Lovable can send Kirora its sign-ups, the actions people take and the emails it needs to send. Add Kirora to your Lovable workspace once as a custom connector; then any project in that workspace can use it by asking in the chat (“When someone signs up, add them to Kirora”).

The connector keeps your Kirora API key in Lovable’s connector gateway: Lovable calls Kirora from your app’s server side, and the key never reaches the browser or the project’s code.

1 Create a Kirora API key

In Kirora, open Developer → API keys and create a key with the automation preset: it writes contacts, events and lists and sends transactional email, and cannot send campaigns or change journeys (scopes). Copy the key: it is shown once.

2 Add Kirora as a custom connector in Lovable

A Lovable workspace admin or owner adds it under Connectors, as a new custom connector:

Setting Value
Name Kirora
Base URL https://api.kirora.io
Authentication Bearer token, the key from step 1

Then add the three knowledge files below, each as written. They are what Lovable reads to call Kirora correctly; keep their names.

3 Use it in a project

Link the connector to a project by asking in its chat, then ask for what you need:

  • “When someone signs up, identify them in Kirora with their email and name.”
  • “Track an Order Completed event in Kirora after checkout, with the order total and currency.”
  • “Send the order confirmation through Kirora’s transactional email.”

Journeys, segments and campaigns stay in Kirora: the app only reports what happened, and Kirora decides what to send and when.

Knowledge file: Kirora contacts

MD
# Kirora: contacts

Kirora is the email and messaging platform this app reports its users to. Call it from
the server only, through the Kirora connector; never from browser code.

Create or update a contact whenever a user signs up or changes their details:

POST /v1/contacts/identify
{ "externalId": "<the app's user id>", "email": "<email>", "firstName": "<first name>",
  "lastName": "<last name>", "attributes": { "plan": "free" } }

- Always send `externalId` (the app's own user id) and `email`. Kirora finds an existing
  contact by externalId, then email, so calling it again updates the same contact.
- Returns 201 when it created the contact, 200 when it updated one.
- `attributes` are custom fields (letters, numbers, _ - . in a key); a value of null
  removes one.
- Do not set consent unless the user ticked a box agreeing to marketing email. If they
  did: "consent": { "email": true, "statement": { "basis": "opted_in",
  "evidence": "<where they agreed, e.g. sign-up form on example.com>" } }.

Knowledge file: Kirora events

MD
# Kirora: events

Report what users do as events; Kirora's journeys and segments act on them. Call from
the server only, through the Kirora connector.

POST /v1/events/track
Idempotency-Key: <a stable id for this event, e.g. "order-1234-completed">
{ "externalId": "<the app's user id>", "name": "<Event Name>",
  "properties": { ... }, "occurredAt": "<ISO 8601 time, optional>" }

- Identify the contact first (POST /v1/contacts/identify): an event for a contact Kirora
  does not have is refused with 404.
- Name events in Title Case, past tense: "Signed Up", "Trial Started", "Order Completed".
- Commerce events use Kirora's standard names and properties: "Order Completed" with
  order_id, total (a number in major units, e.g. 42.50), currency (ISO code, e.g. "USD")
  and products (each with product_id, name, price, quantity).
- Send the same Idempotency-Key when retrying, so the event is recorded once.

Knowledge file: Kirora transactional email

MD
# Kirora: transactional email

Send one email a user needs now (a receipt, a password reset, a confirmation). Call from
the server only, through the Kirora connector. Marketing email is sent from Kirora's
journeys and campaigns, not from the app.

POST /v1/transactional/messages
Idempotency-Key: <a stable id for this send, e.g. "receipt-order-1234">
{ "to": { "email": "<recipient>" },
  "email": { "from": "<Name> <address@your-verified-domain>",
             "subject": "<subject>", "html": "<html body>" } }

- The from address must be on a domain verified in Kirora.
- To use a template made in Kirora instead of html: "email": { "template": "<alias>" },
  with its values in "data": { ... } (read in the template as {{ data.<key> }}).
- Returns 202: the message is queued. The same Idempotency-Key never sends twice.

What to check

  • The connector’s key is a server key: anyone with it can write to your contacts, so never paste it into front-end code or a public repository.
  • Kirora’s public API reference lists every call: start from Quickstart and Events.