How to trigger a Control Room process from a Typeform submission

Typeform is a popular tool for creating and managing online forms. In this article, we will see how you can trigger a process in Control Room when a user submits a Typeform using Webhooks.

You will need:

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

Create a new process in Control Room and enable API access

  1. Access Control Room, select your organization and workspace and create a new process under the Workforce tab. For this example, we decided to set up a new workspace called typeform. In it we have created a process called typeform example process
  2. Enable the API access for your workspace, check the trigger_processes permission, and create the key.

Generate a callback URL for triggering your process in Control Room

Click API Helper from the top navigation. Select the following settings from the API Helper:

  • What Do You Want To Do? -> Start process with with a single work item payload
  • Choose Process -> Select your process.
  • Choose API Key -> Choose the API key you created in the previous steps.

At the bottom of the API Helper, you see a generated curl command. The command is generated based on your choices in the API Helper. It includes the Control Room callback URL and your API token (RC-WSKEY).

Copy the URL part after POST, without the quotes ("). It looks something like this:

https://api.eu1.robocorp.com/process-v1/workspaces/abc123/processes/abc123/runs?

Replace the runs? part like this:

https://api.eu1.robocorp.com/process-v1/workspaces/abc123/processes/abc123/runs-qs-authorization?token=your-token-here

Copy the token (after RC-WSKEY) from the generated curl command as the value of the token parameter.

The most secure way to call Control Room APIs is to include the authorization information in the request headers. Since you can not do that in Typeform, there's a less secure way to include the token in the URL. That is what we use in this case.

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

Create a new robot in VS Code

*** Settings ***
Documentation       A simple robot demonstrating how to get data from
...                 a Typeform submission.

Library             RPA.Robocorp.WorkItems


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

Robot code explained

  • The RPA.Robocorp.WorkItems library allows us to access the data coming from Typeform via the webhook.
  • ${payload}= Get Work Item Payload: The Get Work Item Payload keyword gets 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 Control Room

  1. Link VS Code to Control Room.
  2. Upload the robot to Control Room.

Add the robot step to the process in Control Room

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

Submit the Typeform and see the results in Control Room

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

Control Room process started by API

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

Control Room - View log results

You can also inspect the data that was passed to the process using the Control Room UI:

Control Room - View work item

Next steps

Now you know how to set up Typeform and Control Room 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:

Learn more about the libraries mentioned on this page:

May 13, 2022