Getting started

If you have not yet set up Trigger.dev in your project, go to the quick start guide.

Installation

npm install @trigger.dev/typeform@latest

Authentication

Typeform supports Personal Access Tokens, to create yours read the Typeform Personal Access Token guide.

import { Typeform } from "@trigger.dev/typeform";

//create Typeform client using a person access token
const typeform = new Typeform({
  id: "typeform-1",
  token: process.env.TYPEFORM_PAT!,
});

Get notified of new form responses

The Typeform Integration allows you to trigger a job run when a new form response is submitted using the onFormResponse trigger:

import { client } from "@/trigger";
import { Typeform } from "@trigger.dev/typeform";
import { Job } from "@trigger.dev/sdk";

export const typeform = new Typeform({
  id: "typeform-1",
  token: process.env.TYPEFORM_API_KEY!,
});

client.defineJob({
  id: "do-something-on-new-responses",
  name: "Send a message to slack on new responses",
  version: "0.1.1",
  trigger: typeform.onFormResponse({
    uid: "<form id>",
    tag: "your-tag-here",
  }),
  run: async (payload, io, ctx) => {},
});

To find your Form ID, visit your Typeform dashboard and find the form you’d like to use. Click on the “Share” navigation link and you’ll find your Form ID in the share URL:

Typeform Form ID

The tag parameter is a unique name you want to use for the webhook, and maps 1-to-1 with a single webhook source. Changing the tag will cause another webhook to be registered with Typeform. You can make use of the same tag value in multiple job triggers.

Tasks

All tasks

Function NameDescription
listFormsRetrieve a list of Forms.
getFormGet a single form by uid.
listResponsesPagintated list of responses by form.
getAllResponsesWill collect all the responses on a form by making multiple requests to listResponses

Usage

import { Typeform } from "@trigger.dev/typeform";

//create Typeform client using a person access token
const typeform = new Typeform({
  id: "typeform-1",
  token: process.env.TYPEFORM_PAT!,
});

client.defineJob({
  id: "typeform-tasks",
  name: "Typeform Tasks",
  version: "0.1.0",
  integrations: { typeform },
  trigger: eventTrigger({
    name: "typeform.tasks",
  }),
  run: async (payload, io, ctx) => {
    const forms = await io.typeform.listForms("list-forms");

    const form = await io.typeform.getForm("get-form", {
      uid: payload.formId,
    });

    const listResponses = await io.typeform.listResponses("list-responses", {
      uid: payload.formId,
      pageSize: 50,
    });

    const allResponses = await io.typeform.getAllResponses("get-all-responses", {
      uid: payload.formId,
    });
  },
});

Using the underlying client

You can use the underlying client to do anything @typeform/api-client supports:

import { Typeform } from "@trigger.dev/typeform";

//create Typeform client using a person access token
const typeform = new Typeform({
  id: "typeform-1",
  token: process.env.TYPEFORM_PAT!,
});

client.defineJob({
  id: "typeform-client",
  name: "Typeform Client",
  version: "0.1.0",
  integrations: { typeform },
  trigger: eventTrigger({
    name: "typeform.client",
  }),
  run: async (payload, io, ctx) => {
    const form = await io.typeform.runTask(
      "create-form",
      async (client) => {
        return client.forms.create({
          data: {
            title: "My Form",
            fields: [
              {
                title: "What is your name?",
                type: "short_text",
                ref: "name",
              },
              {
                title: "What is your email?",
                type: "email",
                ref: "email",
              },
            ],
          },
        });
      },
      { name: "Create Form" }
    );
  },
});

Example jobs

Code examples

Check out pre-built jobs using Typeform in our API section.