โ† Integrations

No-code / CMS ยท JSON

Kundli matching in Bubble with the API Connector

A matchmaking or wedding app built in Bubble needs one call: two births in, a 36-point Ashtakoot score out. The API Connector does it without a plugin of its own. The parts worth getting right are the private key, the shape Bubble learns when you initialise the call, and telling the API which person is the groom.

Updated

How this page was checked: Bubble was not run. The exact request the API Connector call is configured to send was executed with curl against the in-memory API - the 22/36 result, the swapped-order 21/36, the both-female case and the blank-gender 400 below are from those runs.

Add the API and keep the key private

  • In the Plugins tab, install API Connector (published by Bubble), open it and add an API named AstroNode.
  • Set Authentication to Private key in header. Key name Authorization, key value Bearer aie_live_....
  • If the form also offers a development key, give it a separate AstroNode key, so testing in the development version does not spend the live key's quota.

API Connector calls are sent from Bubble's servers, and the authentication value set here is never sent to the page. What can leak is a call parameter: each <placeholder> in the body gets a Private checkbox, and a parameter that is not private can be set by the page. That is what you want for the two births (they come from the form), and it is why the key must never be a parameter.

The call

Call settings in the API Connector
SettingValue
NameGun Milan
Use asAction - run it from the workflow behind your "Check match" button
Data typeJSON
Method and URLPOST https://api.astronode.dev/v1/compatibility
Body typeJSON, with the body below

Body - every <name> becomes a parameter. Text values are quoted, numbers are not:

json
{
  "person_a": { "date": "<a_date>", "time": "<a_time>", "tz_offset_minutes": <a_tz>, "lat": <a_lat>, "lng": <a_lng> },
  "person_b": { "date": "<b_date>", "time": "<b_time>", "tz_offset_minutes": <b_tz>, "lat": <b_lat>, "lng": <b_lng> },
  "genders": { "person_a": "<a_gender>", "person_b": "<b_gender>" }
}

Bubble substitutes each value as text, exactly where the placeholder sits. Inside quotes it becomes a JSON string; outside quotes it must already be a valid number - so feed <a_lat> from a number field, not a text input that might hold 19.076 N.

Initialize call: Bubble learns the response from a real answer

Before a call can be used in a workflow, Bubble asks you to Initialize call: it sends the request once with the values typed into the parameter fields and records the shape of what comes back. Use a real pair of births, because an error response would teach Bubble the error's shape instead. The values used here:

data for 24 Apr 1973 17:25 Mumbai (male) and 18 Feb 1976 08:00 Bengaluru (female), koots trimmed to three:

json
{
  "total": { "score": 22, "max": 36, "bucket": "Moderate" },
  "koots": [
    { "name": "graha_maitri", "score": 3, "initial_score": 1, "max": 5, "pass": true,
      "cancellation_note": "Maitri Dosha cancelled due to the boy's strong Moon" },
    { "name": "bhakoot", "score": 7, "initial_score": 7, "max": 7, "pass": true, "cancellation_note": "" },
    { "name": "nadi", "score": 0, "initial_score": 0, "max": 8, "pass": false, "cancellation_note": "Nadi Dosha Present" }
  ],
  "match_percentage": 61,
  "manglik_match": { "boy_present": false, "girl_present": true, "status": "caution",
    "note": "Only the girl is manglik. Traditional reading flags this as a manglik mismatch." },
  "slotting": { "groom": "person_a", "basis": "gender" }
}

After initialising, the workflow's next steps can read Result of step 1's data total score and so on, and koots arrives as a list - bind it to a repeating group with one row per koot, showing score of max and the cancellation_note when it is not empty. If you change the body later, initialise again so Bubble picks up the new fields.

Who is the groom

Varna, Gana and the manglik reading are directional: they compare the groom's chart with the bride's. Without genders, the API reads person_a as the groom. A form that lets either partner fill in the first slot will therefore give different answers for the same couple:

Same two births, four requests (real responses)
RequestScoreslottingManglik note
Mumbai birth as person_a, genders male / female22 / 36person_a, basis genderOnly the girl is manglik
Bengaluru birth as person_a, no genders21 / 36 (Varna 0)person_a, basis orderOnly the boy is manglik
Bengaluru birth as person_a, genders female / male22 / 36person_b, basis genderOnly the girl is manglik
Both marked female21 / 36basis lower-of-both-

Send genders from the form and the order stops mattering. When both genders are the same, the API scores the pair both ways and returns the lower result, saying so in slotting.basis. How the score is built: Ashtakoot scoring.

The mistakes that bite first

  • A blank dropdown. If the gender dropdown is empty, Bubble still substitutes the placeholder and sends "person_a": "". That returned 400 VALIDATION_ERROR with Invalid option: expected one of "male"|"female". Make the dropdown required, or use a second call without the genders object for users who skip it.
  • Birth time stored as a Bubble date. Bubble's date type is an instant and is shown in the viewer's time zone, so a birth time saved as a date drifts when someone in another zone opens the record. Store the birth date and time as text (1973-04-24, 17:25) plus the birthplace's offset as a number. Why the offset is the birthplace's.
  • 12-hour time. A time input formatted as 5:25 PM returned 400 with time must be HH:mm or HH:mm:ss (24h). Format it as 17:25 before it reaches the call.
  • The plan. /v1/compatibility is a Hobby endpoint; a Free key gets 403 PLAN_REQUIRED, which Initialize call will show as the response.

Questions

Which AstroNode endpoints does the Bubble example call?
1 endpoint: Kundli Matching (Ashtakoot Gun Milan) (POST /v1/compatibility).
Was the Bubble code on this page actually run?
Bubble was not run. The exact request the API Connector call is configured to send was executed with curl against the in-memory API - the 22/36 result, the swapped-order 21/36, the both-female case and the blank-gender 400 below are from those runs.