Last active
May 30, 2019 18:54
-
-
Save jwtd/196b768f86eb87bbe5da4a149190f944 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const TF = require('@typeform/api-client'); | |
const tf = TF.createClient({ | |
token: process.env.TYPEFORM_PERSONAL_TOKEN | |
}); | |
const data = { | |
"title": "This is my test form", | |
"theme": { "href": "https://api.typeform.com/themes/rqYVKG" }, | |
"workspace": { "href": "https://api.typeform.com/workspaces/Ed4yM5" }, | |
"settings": { | |
"is_public": true, | |
"is_trial": false, | |
"language": "en", | |
"progress_bar": "proportion", | |
"show_progress_bar": true, | |
"show_typeform_branding": true, | |
"meta": { "allow_indexing": false }, | |
"notifications": { | |
"self": { | |
"recipients": ["Jordan.Duggan@Gmail.com"], | |
"subject": "Typeform: New response for {{form:title}}", | |
"message": "Your typeform {{form:title}} has a new response:\n{{form:all_answers}}\nLog in to view or download your responses at\nhttps://admin.typeform.com/form/mqSJYf/results\n{{link:report}}\nYou can turn off or configure self notifications for this typeform at\nhttps://admin.typeform.com/form/mqSJYf/create/hash/notifications\n\n", | |
"enabled": true | |
} | |
} | |
}, | |
"fields": [ | |
{ | |
"type": "statement", | |
"title": "This is my statement", | |
"properties": { "hide_marks": true, "button_text": "Continue" } | |
}, | |
{ | |
"type": "short_text", | |
"title": "This is SHORT text question", | |
"validations": { "required": true } | |
}, | |
{ | |
"type": "long_text", | |
"title": "This is LONG text question", | |
"validations": { "required": true } | |
}, | |
{ | |
"type": "date", | |
"title": "This is a DATE question", | |
"validations": { "required": true }, | |
"properties": { "structure": "MMDDYYYY", "separator": "/" } | |
}, | |
{ | |
"type": "number", | |
"title": "This is a NUMBER question", | |
"validations": { "required": true } | |
}, | |
{ | |
"type": "website", | |
"title": "This is a WEBSITE question", | |
"validations": { "required": true } | |
}, | |
{ | |
"type": "yes_no", | |
"title": "This is a Yes/No question", | |
"validations": { "required": true } | |
}, | |
{ | |
"type": "opinion_scale", | |
"title": "This is an OPNION SCALE question", | |
"validations": { "required": true }, | |
"properties": { "steps": 10, "start_at_one": false } | |
}, | |
{ | |
"type": "rating", | |
"title": "This is a RATING SCALE question", | |
"validations": { "required": true }, | |
"properties": { "steps": 10, "shape": "star" } | |
}, | |
{ | |
"type": "multiple_choice", | |
"title": "This is a MULTIPLE CHOICE question", | |
"validations": { "required": true }, | |
"properties": { | |
"randomize": false, | |
"allow_multiple_selection": false, | |
"allow_other_choice": false, | |
"vertical_alignment": true, | |
"choices": [ | |
{ "label": "Option A" }, | |
{ "label": "Option B" }, | |
{ "label": "Option C" } | |
] | |
} | |
} | |
] | |
} | |
tf.forms.create({data}).then(response => { | |
console.log(response); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment