How to trigger a Robocorp Cloud process from a Typeform submission

Typeform is a popular tool to create and manage online forms. In this article, we will see how you can trigger a process in Robocorp Cloud when a user submits a Typeform using Webhooks.

You will need:

  • a Typeform account (this will work with a free account as well)
  • a Robocorp Cloud account
  • Robocorp Lab installed and connected to your Robocorp Cloud account

Get access to Typeform and create a form

Register or log in to your Typeform account and create a test form using the UI.

As an example, we have created a very simple form with three fields:

  • an email field
  • a text field
  • a numeric field (opinion scale)

Form overview in the Typeform UI

You can try the test form here.

Create a new process in Robocorp Cloud and enable the Process API for it

  1. Access Robocorp Cloud, select your organization and workspace and create a new process. For this example, we decided to set up a new workspace called typeform. In it we have created a process called typeform example process: Typeform workspace and process created

  2. Enable the Process API access for your process and take note of the secret and the URL. Enabling the process API access

  3. With the information from the Robocorp Cloud UI, we can create the webhook URL that we will use to trigger this process remotely via the API. The URL will look like this:

    https://api.eu1.robocloud.eu/workspace-v1/workspaces/WORKSPACE_ID_HERE/processes/PROCESS_ID_HERE/runs

    For the API to be able to trigger the process, we will also need to pass the secret to it. If the system we call the API from allows us to add custom headers to the API call, we should pass the secret as a header. If this is not possible (like in our case with Typeform), we can pass the secret as a query parameter instead.

    So our final webhook URL will look like this:

    https://api.eu1.robocloud.eu/workspace-v1/workspaces/WORKSPACE_ID_HERE/processes/PROCESS_ID_HERE/runs?robocloud-process-secret=SECRET_HERE

    If available, the custom header method should always be preferred for security reasons. You can read more about this topic on the API documentation page.

Add the webhook to your form in Typeform

  1. In the Typeform admin UI, select the Connect button in the top bar.
  2. Select the Webhooks button.
  3. Add a new webhook and add the URL that you got in the previous step: Typeform add new webhook
  4. Activate the webhook using the toggle button: Typeform activate webook

Add a new robot in your workspace in Robocorp Cloud

Your process needs to have at least one step associated with it to run.

While in your workspace in Robocorp Cloud, create a new robot. We decided to call it typeform.

Robocorp Cloud - Add a robot

Create a new robot in Robocorp Lab

Our process is set up, but we have no robot added to it. Let's create one!

  1. Open Robocorp Lab and create a new robot: Robocorp Lab - Create a new robot
  2. Open the tasks.robot file in editor mode by right-clicking on the file in the sidebar, and selecting Open With -> Editor, replace the existing content with this script and save the file:
*** Settings ***
Documentation     A simple robot demonstrating how to get data from
...               a typeform submission.
Library           RPA.Robocloud.Items

*** Tasks ***
Get form submission data from Typeform and log it
    ${payload}=    Get Work Item Payload
    Log    ${payload}

Robot code explained

  • We are adding the RPA.Robocloud.Items library, that allows us to access the data coming from Typeform via the webhook.
  • ${payload}= Get Work Item Payload: Using the Get Work Item Payload keyword, we access the payload data coming from Typeform.
  • Log ${payload}: For now, we will just print out the content of what we get from Typeform to the log.

Upload the robot to Robocorp Cloud

  1. Make sure that you have linked Robocorp Lab to your Robocorp Cloud account
  2. Click on the Publish to Robocorp Cloud button on the top right corner.
  3. Select your workspace and your robot in the UI and click on the Publish to Robocorp Cloud button:

Robocorp Lab push to Robocorp Cloud

Add the robot step to the process in Robocorp Cloud

In Robocorp Cloud, select your process and add to it the robot you just uploaded: Robocorp Cloud - Add robot step to process

Submit the Typeform and see the results in Robocorp Cloud

Submit your form in Typeform. This will cause the webhook to fire, and Robocorp Cloud will run your process!

Robocorp Cloud process started by api

When the process is complete, you can see the submitted values in the log:

Robocorp Cloud - View log results

You can also inspect the data that was passed to the process using the Robocorp Cloud UI:

Robocorp Cloud - View work item

Next steps

Now you know how to set up Typeform and Robocorp Cloud to run a robot when a form is submitted. Pretty neat!

You will probably want to do something with the data that you get from Typeform, so here are some pointers: