createsurvey: Create survey

Description Usage Arguments Details Value Author(s) References Examples

Description

Create a new survey (and collector) from a survey template

Usage

1
2
3
4
5
createsurvey(template = NULL, survey = NULL, title, collector_name = NULL,
             type = 'email', recipients = NULL, email_replyto = NULL,
             email_subject = NULL, email_body = NULL,
             api_key = getOption('sm_api_key'),
             oauth_token = getOption('sm_oauth_token'), ...)

Arguments

template

A Survey Monkey template ID number, possibly returned by templates. Must specify either template xor survey.

survey

A Survey Monkey survey ID number (or an object of class “sm_survey” from which it can be extracted), possibly returned by surveylist. Must specify either template xor survey.

title

A character string to use as the title of the survey.

collector_name

A character string to use as the name of the collector. If NULL, the default “New Email Invitation” will be used.

type

Type of collector to create. Currently only allowed value is “email”. Weblink collectors can be created using createcollector.

recipients

A list of a list for each recipient containing email addresses and potentially first names, last names, and a “Custom ID” for each recipient. Only email address is required. User can specify vectors between 1 and 4 items long. If lists do not have element names, items in each list are assumed to be email address, first name, last name, and custom ID (in that order). If supplied in a different order, each list element must be named: email, first_name, last_name, and custom_id.

email_replyto

A character string containing the reply-to email address for the survey.

email_subject

A character string containing the subject line for the email to be sent to recipients.

email_body

A character string containing the body of an email to be sent to recipients. The string should contain [SurveyLink] as a placeholder for the survey link and [OptOutLink] as a placeholder for the standard Survey Monkey opt-out. Unless you have a Gold or Platinum account and have opted out of notification, you also need to include the footer link, [FooterLink].

api_key

Your API key. By default, retrieved from getOption('sm_api_key').

oauth_token

Your OAuth 2.0 token, as generated by smlogin. By default, retrieved from getOption('sm_oauth_token').

...

Other arguments passed to POST.

Details

Creates a new survey from a template or by copying an existing survey and generates an email collector for the specified survey. Survey Monkey BASIC users can only have three collectors per survey. Requesting more will result in a message with additional information about upgrading your account.

Value

A list containing an object of class sm_collector, an object of class sm_survey, and additional details.

Author(s)

Thomas J. Leeper

References

https://developer.surveymonkey.com/mashery/create_flow

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
smlogin()

# create survey by copying existing survey
s <- surveylist()
createsurvey(survey = s[[1]]$survey_id, title = 'Copied survey',
    collector_name='Emails', 
    recipients = list(list('first@example.com'), list('second@example.com')),
    email_replyto='me@example.com', email_subject='Please complete a short survey!')

# create survey from template
tmps <- templates()
createsurvey(template = tmps[[1]]$template_id, title = 'Copied survey',
    collector_name='Emails', 
    recipients = list(list('first@example.com'), list('second@example.com')),
    email_replyto='me@example.com', email_subject='Please complete a short survey!')    

## End(Not run)

leeper/Rmonkey documentation built on May 21, 2019, 12:36 a.m.