Add New Entries to Algolia’s Search Index

In this use case, we will cover a scenario where, if a user creates a new entry in Contentstack, Automations should be able to add it immediately to Algolia’s search index.

Let's break this scenario to see what must be the trigger event and the consequent action required to execute the Automation:

  • Set Up the Contentstack “New Entry” Trigger Event: This trigger event is activated whenever a user creates a new entry for a particular stack, and in turn, it activates the Automation.
  • Set Up the Algolia “Index Entries” Action: Once the above event triggers the Automation, it will add your entry to Algolia’s Search index.

The steps to set up the Automation are as follows:

  1. Create an Automation
  2. Set up the Contentstack Trigger Event
  3. Set up your Algolia Action Connector
  4. Test out the Automation for Algolia Search Index

Let’s look at the setup in detail.

  1. Create an Automation

    To create an automation, perform the steps given below:

    1. Log in to your Contentstack account and click the “Automation Hub” icon.
    2. Click + New Project and provide the required details to create a new project.
    3. Click + New Automation to add the steps required to configure the automation.

    Next, let’s look at the steps to set up the trigger event.

  2. Set up the Contentstack Trigger Event

    1. Click Configure Trigger and select the Contentstack connector.
      Select-Contentstack-Trigger.png
    2. Add your Contentstack account. For more information, refer to the Contentstack Trigger documentation.
    3. Once done, select New Entry from the list of trigger events and define the rest of the steps needed to set up the trigger (refer to steps 3 to 10 in Contentstack Trigger).
      Configure-Contentstack-Trigger.png
    4. Click Test Trigger to execute and test the trigger that you configured.
  3. Set up your Algolia Action Connector

    Let’s configure the Algolia action connector.

    1. In the Configure Action section, select the Algolia connector.
      Select-Algolia-Action-Connector.png
    2. Select the Index Entries action.
      Select-Action.png
    3. Click the + Add New Account button to select your Algolia account.
      Add-New-Algolia-Account.png
    4. To add your Algolia account, refer to the Algolia Connector document.
    5. Select the Index Name where you want to send the data.
    6. Enter the data to be added to the index in the Entries field.
    7. Note: Provide your index data as per your object schema and in JSON format only. You can also pass dynamic data from the output of the previous step i.e., Entry Trigger. For that, just create an entry in your stack and enable the automation. In the execution logs, you can see the status of the automation.

    8. Click Proceed.
      Configure-Algolia-Action-Proceed.png
    9. This completes the configuration of your action. Now, click the Test Action button to send your data to the Algolia index.
      Test-Algolia-Action.png
    10. Once the execution is successful, you will get the final output as seen in the screenshot in step 10.
    11. This should initiate Algolia to add your entry into its Search Index. You need to navigate to your Algolia Index section and check the latest indexed entry. If it displays the data we passed as objects in the Algolia action connector, that means the automation works successfully.

    12. Navigate back to your automation set up page, and click Save and Exit to finish setting up the action.
      Save-Exit.png
    13. You need to enable automation in order to test it.
    14. This sets the Algolia action connector.

  4. Test out the Automation for Algolia Search Index

    Now, let’s see how you can test out your Automation. To do so, perform the steps given below:

    1. Go to Contentstack and create an entry for the content type that you selected in your trigger event in step 2.
      This should trigger your Automation.
    2. Now, navigate to Algolia, log in and check the latest indexed entry in your Algolia Index section. If your Automation worked, you should see the following output:
      Algolia-Output.png

Was this article helpful?

Thanks for your feedbackSmile-icon

On This Page

^