Made in Builder.io

Upcoming webinar with Figma: Design to Code in 80% Less Time

Announcing Visual Copilot - Figma to production in half the time

Builder.io logo
Talk to Us
Platform
Developers
Talk to Us

Blog

Home

Resources

Blog

Forum

Github

Login

Signup

×

Visual CMS

Drag-and-drop visual editor and headless CMS for any tech stack

Theme Studio for Shopify

Build and optimize your Shopify-hosted storefront, no coding required

Resources

Blog

Get StartedLogin

Use the Builder Algolia plugin to integrate Algolia, a powerful search engine API, into your Builder app. By connecting Builder.io with Algolia, you can enhance your application's search and recommendation capabilities and improve user experience (UX).

The video below shows the complete process for setting up the algolia plugin and connecting your Algolia account with Builder. Detailed written instructions follow the video further down the page.

To use Algolia with Builder, you need to create a restricted API key. Be careful with this key as it enables permissions for features besides search.

To create a restricted key in Algolia:

  1. Go to your account settings for Algolia.
  2. Go to API Keys.
  3. Go to the All API Keys tab.
  4. Click the New API Key button.
  5. In the dialogue that opens, add a description of your API, for example, API Key for connecting to Builder.
  6. Optional: add an index or indices. An index in Algolia corresponds to a model in Builder. As an example, you might add page if you want to sync your Builder Page model. You can leave it blank to sync all models.
  7. In the access control list (ACL) field near the bottom, add search, addObject, and deleteObject. These allow Builder.io to connect to Algolia and make changes to your index.
  8. Click the Create button.
  9. When you've created the API Key for your Builder model, copy the API Key and head back to Builder.

The following video shows creating an API Key in Algolia.

The screenshot below is of the Create an API Key dialogue in Algolia with the description, an optional index (a Builder model name), and ACL fields filled in. This screenshot is a still image of the one in the demo video above and is included here for easier reference.

Screenshot of Create API Key dialogue in  Algolia.

Syncing Builder models (Algolia indices)

Builder models are known as indices in Algolia.

The specific models that get synchronized with Algolia depend on what you specify as the index in the Indices field within Algolia. If you specify a particular Builder model, the synchronization only applies to that model. If you don't specify any models (or indices in Algolia), all models sync.

After configuring the Algolia plugin and establishing a connection to Algolia, your Builder models will automatically synchronize with Algolia when you publish or unpublish content.

For more information, visit Intro to Models.

To add the Algolia plugin:

  1. Go to Plugins in Builder.
  2. In the Algolia tile, set toggle to the on position.
  3. If a Settings button doesn't appear on the Algolia tile, refresh the page. Click on the Settings button.
  4. In the dialogue that opens, add the API Key you created for syncing with Builder and your Algolia App ID available in your Algolia account settings.
  5. Click Save.
  6. Go to Models and open the model you specified in Algolia.
  7. In the Advanced tab, click Sync next to Sync to Algolia.
  8. Accept the requests for access.
  9. To view or edit the resulting Webhook, click Edit, next to Webhooks.

The video below shows this process using a Page model as an example.

Below is an example of the payload that is delivered to Algolia. You can set up filters or facets using this payload shape as a reference.

{
  "id": "f87e7603575a438e9c8a3af0f0c11206",
  "variations": {},
  "lastUpdatedBy": "eN5ERlll3vRab83WDgoFPIJM9jp2",
  "metrics": {
    "impressions": 0,
    "clicks": 0
  },
  "createdDate": 1643722997011,
  "meta": {
    "kind": "page",
    "hasLinks": false
  },
  "modelId": "b9544d8e828e4c188ab4585c72ede2ed",
  "ownerId": "6314dcbfce4d40698c53786a58829190",
  "@version": 3,
  "lastUpdated": 1643723175362,
  "data": {
    "title": "home",
    "blocksString": "[...]",
  "name": "home",
  "published": "archived",
  "createdBy": "eN5ERlll3vRab83WDgoFPIJM9jp2",
  "priority": 0,
  "testRatio": 1,
  "query": [
    {
      "operator": "is",
      "@type": "@builder.io/core:Query",
      "value": "/",
      "property": "urlPath"
    }
  ],
  "lastUpdateBy": null,
  "objectID": "f87e7603575a438e9c8a3af0f0c11206"
}

For even more functionality, you can use Algolia's JavaScript API Client or a library such as InstantSearch.

For the most up-to-date code for the Algolia Plugin, visit Builder's GitHub Repo.

Was this article helpful?

Product

Visual CMS

Theme Studio for Shopify

Sign up

Login

Featured Integrations

React

Angular

Next.js

Gatsby

Get In Touch

Chat With Us

Twitter

Linkedin

Careers

© 2020 Builder.io, Inc.

Security

Privacy Policy

Terms of Service

Newsletter

Get the latest from Builder.io

By submitting, you agree to our Privacy Policy