Automation Hub Real World Scenarios

Example 1: Add a Newly Created Entry 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 on the “Automation Hub” icon.
    2. Click on + New Project and provide the required details to create a new project.
    3. Click on + 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 on Configure Trigger and select the Contentstack connector.
      1.Configure_Trigger_Contentstack.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).
      2.Select_New_Entry.png
    4. Click on 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.
    2. 3.Select_Algolia_Connector.png
    3. Select the Index entries action.
      4.Select_Index_Entries_Action.png
    4. Click the + Add New Account button to select your Algolia account.
      5.Click_Add_New_Account.png
    5. To add your Algolia account, refer to the Algolia Connector document.
    6. Select the Index Name where you want to send the data.
    7. Enter the data to be added to the index in the Entries field.
    8. 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.

    9. Click on Proceed.
      6.Click_Proceed_Algolia.png
    10. This completes the configuration of your action. Now, click on the Test Action button to send your data to the Algolia index.
      7.Click_Test_Action_Algolia.png
    11. Once the execution is successful, you will get the final output as seen in the screenshot in step 10.
    12. 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.

    13. Navigate back to your automation set up page, and click on Save and Exit to finish setting up the action.
      8.Click_Save&Exit.png
    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:
      9.Check_Latest_Index_Algolia.png

Example 2: Add Newly Transformed Input data to Gmail

In this use case, we will cover a scenario where, if a user creates a new entry in Contentstack, Automations should be able to transform the input data as per the transform modifier. You can use different transform modifiers such as camelCase, capitalize etc., to modify your final output.
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 Transform Action: Once the above event triggers the Automations, it will modify the JSON code passed in the transformation box.
  • Set Up the Gmail “Send Email” Action: Once the Transform action is completed, you can post the transformed JSON data to Gmail.

Let’s look at the setup in detail.

  1. Create an Automation to add newly created entries in Contentstack to transform and configure Gmail to post the data

    To create an automation, perform the steps given below:

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

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

  2. Set up the Contentstack Trigger event

    1. Click on Configure Trigger and select the Contentstack connector.
      10.Configure_Trigger_Contentstack.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 steps 3 to 10 in Contentstack Trigger).
      11.Select_New_Entry.png
    4. Click on Test Trigger to execute and test the trigger that you configured.
  3. Set up your Transform action connector

    Let’s configure the Transform action connector.

    1. In the Configure Action section, click the Transform connector.
      12.Select_Transform_Action_Connector.png
    2. Select the Transform action.
      13.Select_Transform_Action.png
    3. Click on Add Input, and enter a variable name for the Input Name (say, “name”) and an Input Value for the variable (say, “john” in lowercase letters) (see screenshot in next step).
    4. Note: You can even pass the value directly into the Transformation box.

    5. Let’s enter the JSON code that uses the “capitalize()” modifier in the Transformation box. Use the following code: {“result” : “{capitalize(name)}” }14.Enter_JSON_Captalize.png
    6. Click on Proceed.
    7. Click on Test Action to execute the JSON code.
      15.Click_Test_Action.png
    8. You should see the output with the first letter capitalized. Click Save and Exit for the Transform process flow.
      16.Click_on_Save&Exit.png

    This sets the Transform action connector.

  4. Test out the Automation

    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. Let’s see how to post the JSON data by sending an email through the Gmail action connector.
      1. In the Configure Action section, click on the Gmail connector.
        17.Select_Gmail_Action_Connector.png
      2. Select the Send Email action.
        18.Select_Send_Email_Action.png
      3. Click the + Add New Account button to select your Gmail account.
        19.Click_Add_New_Account.png
      4. To add your Gmail account, refer to the Gmail Connector document.
      5. On the actions page, enter the To email address, the Subject line, and the Body of the email. In the Body, select the output from the transform connector.
        20.Configure_Action.png
      6. The Show optional fields toggle switch allows you to enter the “Cc” and “Bcc” email addresses. Click Proceed after entering the details.
      7. Click on Test Action to send the email using the Gmail account.
        21.Click_Test_Action.png
      8. Once set, click on Save and Exit.
        22.Click_Save&Exit.png
      9. Now, navigate to Gmail, log in and check the email in the receiver’s email account sent by your Gmail email address. If your Automation worked, you should see the following output:
        23.Check_Email.png

Example 3: End to End Translation using Smartling

The End-to-End Translation use case shows how you can use Contentstack Automation Hub to set up an automated language translation system for your Contentstack-powered website.
In this use case, you will walk through the steps required to perform end-to-end translation of an entry created/updated in contentstack. Also, you will integrate a communication medium (say slack) to notify us whenever an entry gets successfully translated.
The entire translation process consists of eight major steps right from configuring the entry trigger to setting up the slack channel.

Here is the list of processes we need to execute.

  1. Configure Entry Trigger
  2. Add Content to Project
  3. Pause an Automation
  4. Download Translated Content
  5. Add the Transform Function
  6. Localize an Entry
  7. Set Entry Workflow
  8. Send Message

Let’s have a look at the steps in detail. 

  1. Configure Entry Trigger

    1. Log in to your Contentstack account and click on the “Automations Hub” icon.
    2. Click on + New Project to add a new project.
    3. Click on + New Automation.
    4. Enter the Automation Name and Description.
    5. Click on Create.
    6. In Configure Trigger, select the Contentstack Trigger connector
    7. 1.Select_Contentstack_Trigger.png
    8. Click on the Entry Trigger option.
      2.Select_Entry_Trigger.png
    9. Click on + Add New Account.
      3.Entry_Trigger_Add_Account.png
    10. Select the Event and the Stack for which you want to configure the trigger. Once done, click on Proceed.
      4.Trigger_Event&Stack.png
    11. Click on Test Trigger.
      5.Trigger_Test_Action.png
    12. Click on Save and Exit.
  2. Add Content to Project

    After you configure the entry trigger, the next step is to configure the Smartling action connector by adding a project and the content you want to translate.

    1. In Configure Action, select the Smartling action connector.
      6.Select_Smartlng_Connector.png
    2. Click on Add Content to Project action.
      7.Select_Add_Content_to_Project.png
    3. Click on + Add New Account to add your Smartling account.
      8.Click_Add_New_Account.png
    4. Enter the Project ID, the Locale in which you want the content to be translated, and add the Content.
      9.Enter_ProjectID&Locale.png
    5. Add the Callback URL and click on Proceed.
    6. Note: Smartling uses the Callback URL to resume the automations once the content is translated.

      10.Click_Proceed.png
    7. Click on Test Action.
      11.Click_Test_Action.png
    8. You will get the following response once the action is successfully executed.
    9. Note: From the given set of response, preserve the fileUri as it will be used in the next steps.
      12.Add_Content_Response.png
    10. If all looks good, click on Save and Exit to finish the process.

    This sets the Smartling action connector and Add content to the project step.

  3. Pause an Automation

    The third step requires you to configure the Pause connector. The Pause connector lets you pause the automation until Smartling executes the translation process. 

    1. In Configure Action, select the Pause action connector.
      13.Select_Pause_Connector.png
    2. Click on the Pause an Automation action.
      14.Pause_an_Automation.png
    3. Add details from step 1 to the given fields such as file_uri, content_type, and entry_id. Once done, click on Proceed.
      15.Click_Proceed.png
    4. Click on Test Action.
      16.Click_Test_Action.png
    5. You will get the following response once the action is successfully executed.
      17.Pause_a_Rule_Response.png
    6. If all looks good, click on Save and Exit to finish the process.

    This sets the Pause action connector.

  4. Download Translated Content

    Once the content is successfully translated, the next step is to download the translated content.

    1. In Configure Action, select the Smartling action connector.
      6.Select_Smartlng_Connector.png
    2. Click on Download translated content action.
      18.Select_Download_Translated_Content_Action.png
    3. Click on + Add New Account to add an account.
      19.Add_New_Account.png
    4. Enter the Project Id, the Locale, and the File URI you preserved in the previous steps. Once done, click on Proceed.
      20.Click_Proceed.png
    5. Click on Test Action.
      21.Click_Test_Action.png
    6. You will get the following response once the action is successfully executed.
      The translated content is appended in the data1 response shown here.
      22.Download_Translated_Content_Response.png
    7. Click on Save and Exit to finish the process.

    This sets the download translated content action for your Smartling connector.

  5. Add the Transform Function

    In the fifth step, you will add the data1 response preserved in the previous step in a Transform function. This step is required because the Contentstack API expects the translated data in a particular format.

    1. In Configure Action, select the Transform action connector.
      23.Select_Transform_Connector.png
    2. Click on the Transform action.
      24.Select_Transform_Action.png
    3. Enter the Input Name and Input Value for the function in the given fields. Once done, click on Proceed.
      25.Add_details_Transform.png
    4. Click on Test Action.
      26.Click_Test_Action.png
    5. You will get the following response once the action is successfully executed.
      27.Transform_Response.png
    6. Click on Save and Exit to finish the process.

    This sets the Transform function.

  6. Localize an Entry

    1. In Configure Action, select the Contentstack action connector.
      28.Click_Contentstack_Connector.png
    2. Click on the Localize an Entry action.
      29.Localize_an_Entry_Action.png
    3. Click on + Add New Account to add an account.
      30.Localixe_Add_Account.png
    4. Enter details such as Stack, Content Type, Entry, and Locale. Also, add the Entry Data preserved from the Transform function step (step 5). Once done, click on Proceed.
      31.Localize_Add_Details.png
    5. Click on Test Action.
      32.Localize_Test_Action.png
    6. You will get the following response once the action is successfully executed.
      33.Localize_Response.png
    7. Click on Save and Exit to finish the process.

    This sets the Localizing an Entry step.

  7. Set Entry Workflow

    The seventh step requires you to add workflow stages for your stack. This will allow you to define different stages of the review process for your team.

    1. In Configure Action, select the Contentstack action connector.
      28.Click_Contentstack_Connector.png
    2. Click on the Set Entry Workflow action.
      34.Set_Entry_Workflow_Action.png
    3. Click on + Add New Account to add an account.
      35.Add_Account.png
    4. Add details such as Stack, Content Type, Entry, Workflow Stage, and Set the Due Date. Also, set “No” for Notify via Email field and add comments if you want to. Once done, click on Proceed.
      35.Add_details.png
    5. Click on Test Action.
      36.Set_Workflow_Test_Action.png
    6. Click on Save and Exit to finish the process.

    This sets the Set Entry Workflow step.

  8. Send Message

    The last step is to set up a notification channel in Slack.

    1. Click on Configure Action and select the Slack action connector.
      37.Select_Slack_Connector.png
    2. Click on the Send Message to Channel action.
      38.Send_Message_to_Channel_Action.png
    3. Click on + Add New Account.
      39.Send_Message_Add_Account.png
    4. Add the Slack Channel where you want to get the notifications.
      40.Select_Channel.png
    5. Enter the Message body and click on Proceed.
    6. Click on Test Action.
      41.Click_Test_Action.png
    7. Click on Save and Exit to finish the process.

    This sets the last step to set up a notification channel in Slack.

Example 4: Backup Entries or Assets to AWS S3

The Backup Entries/Assets to S3 use case shows how you can use Contentstack’s Automation Hub to automate backing up entries or assets to an AWS S3 bucket.
The AWS Simple Storage Service (S3) is a cloud-based storage service provided by Amazon that allows users to store any amount of data for virtually any use case.

Let’s look at the steps in more detail.

  1. Configure Entry Trigger to Backup Entries or Assets to AWS S3

    1. Log in to your Contentstack account and click on the “Automations Hub” icon.
    2. Click on + New Project to add a new project.
    3. Click on + New Automation.
    4. Enter the Automation Name and Description.
    5. Click on Create.
    6. Select the Contentstack trigger connector.
      1.Select_Contentstack_Trigger.png
    7. Click on the Entry Trigger option.
      2.Select_Entry_Trigger.png
    8. Click on + Add New Account.
      3.Entry_Trigger_Add_Account.png
    9. Select the Event and the Stack for which you want to configure the trigger. Once done, click on Proceed.
      4.Trigger_Event&Stack.png
    10. Click on Test Trigger.
      5.Trigger_Test_Action.png
    11. Click on Save and Exit.
  2. Add an Asset

    The next step requires you to add an asset to the AWS S3 bucket.
    To add an asset, follow the given instructions:

    1. Click on Configure Action tab and select the AWS S3 action connector.
      42.Select_AWS_S3.png
    2. Click on the Create New Object action.
      43.Create_New_Object_Action.png
    3. Click on + Add New Account.
    4. Add Bucket name, File Name, and Content details in their respective fields. Once done, click on Proceed.44.Create_New_Project_Proceed.png
    5. Click on Test Action.
      45.Click_Test_Action.png
    6. Once the action is successfully executed, click on Save and Exit to finish the process.
      46.Create_New_Object_Response.png
    7. Navigate to your AWS S3 bucket and check for the recently uploaded asset. You can view the details in the Object overview section.
      47.AWS_S3_Bucket.png

    This sets the Backup Entries/Assets to AWS S3 scenario.

Was this article helpful?

Thanks for your feedbackSmile-icon

On This Page

^