Forms: Forms SDK
Overview
The Default Forms SDK makes it easy to connect your hosted forms to Default’s platform. It streamlines form submissions, event management, and scheduler integration to enhance your workflows.
Forms SDK is used by customers like: Boompop & Hex!
Features:
-
Form Submission Management: Effortlessly send form data to Default
-
Event Emission: Hook into events like submission success or errors
-
Scheduler Integration: Allow users to book meetings directly from your form
Implementation
Step 1: Create a Form
Create a form
-
Go to Default > Forms > Webforms and create a new form.
-
Pick Default SDK.
Step 2: Include the Forms SDK Web Script
Include the Forms SDK web script
Add the SDK to your webpage:
Access the SDK:
Step 3: Available Methods
Available methods
helloworld
Logs a welcome message to verify that the SDK is loaded correctly:
Submit
Handles form submissions and manages events:
Step 4: Submission & Callbacks
Submission and callbacks
Submission (Required)
Object containing form data and metadata:
-
form_id
(number, required): Unique form identifier -
team_id
(number, required): Team identifier -
responses
(object, required): Question ID to response mapping -
questions
(array, required): Question metadata array
Question Attributes
-
id
- (required): The unique identifier for the question. -
name
- (required): The human-readable name of the question. -
type
- (required): The type of input ("email"
,"text"
,"select"
etc.). -
options
- (optional): For multiple-choice questions, an array of valid options.
Example submission:
Callbacks (Optional)
Event handlers for submission lifecycle:
Step 5: Create a Test Submission
Create a test submission
Create a test submission by submitting a form entry to ensure your setup is working properly. Then, navigate to the Check the Connection step in Default to verify the integration.
Complete the Configuration by:
-
Select the email field to identify the lead.
-
Map your form fields to the corresponding Default attributes.
-
Assign a unique name to the form for easy identification.
This process ensures your form is correctly integrated and ready for future submissions.
Forms SDK Example
Support for Custom Styling Default Forms
The DefaultSDK.insertForm
method allows you to render forms that you’ve previously configured in Default directly on your website. This client-side function gives you the flexibility to style and position the form within your application’s UI while maintaining all the powerful submission and scheduling capabilities of Default’s platform.
-
formId
(string, required): Unique identifier for your form -
teamId
(string, required): Your team’s identifier -
container
(string|HTMLElement, required): Target element for form insertion -
submitText
(string, optional): Custom text for submit button -
Callbacks
(all optional):-
onSuccess: Called after successful submission
-
onError: Called if submission fails
-
onSchedulerDisplayed: Called when scheduler opens
-
onSchedulerClosed: Called when scheduler closes
-
onMeetingBooked: Called when meeting is booked
-
Content Security Policy
If adding to a Content Security Policy (CSP), add *.default.com
to your existing list(s).
For a more specific list of subdomains, you can add the following:
Error Handling
Client-Side Validation (SDK Errors - Emitted via Callback)
Errors will be triggered if:
-
form_id, team_id, responses, questions, or email is missing
-
responses is not an object
-
questions is not an array
-
A response key does not match an entry in the questions array
Server-Side Errors (400 Bad Request)
The server will return a 400 error if:
-
submission is missing
-
form_id or team_id is missing
-
responses or questions are missing
-
email is missing
-
The questions array does not match the expected format
-
No valid responses are found
Server-Side Errors (500 Internal Server Error)
- The endpoint is experiencing an outage
Response Structure
Success ✅
Error ❌
Examples of Form SDK
Boompop
Boompop Live Quiz
Hex
Hex Book a Demo
Was this page helpful?