Learn R Programming

Rmonkey (version 0.3.1)

createcollector: Create a new collector

Description

Create a new weblink or email collector for a survey

Usage

createcollector(survey, name, type = 'weblink', recipients = NULL, email_replyto = NULL, email_subject = NULL, email_body = NULL, api_key = getOption('sm_api_key'), oauth_token = getOption('sm_oauth_token'), ...)

Arguments

survey
A Survey Monkey survey ID number (or an object of class “sm_survey” from which it can be extracted), possibly returned by surveylist.
name
A character string to use as the name of the collector.
type
Either “weblink” or “email”. If email, recipients, email_replyto, and email_subject are required (email_body is optional, defaulting to the default Survey Monkey template).
recipients
A list of character vectors 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 vectors do not have element names, items in each vector are assumed to be email address, first name, last name, and custom ID (in that order). If supplied in a different order, each vector 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 [RemoveLink] as a placeholder for the standard Survey Monkey opt-out.
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.

Value

sm_collector.

Details

Creates a new 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.

References

https://developer.surveymonkey.com/mashery/create_collector https://developer.surveymonkey.com/mashery/send_flow

Examples

Run this code
## Not run: 
# smlogin()
# s <- surveylist()
# 
# # weblink collector
# createcollector(s[[1]]$survey_id, 'survey link', type='weblink')
# 
# # email list collector
# createcollector(s[[1]]$survey_id, 'Emails', type='email', 
#     recipients = list('first@example.com', 'second@example.com'),
#     email_replyto='me@example.com', email_subject='Please complete a short survey!')
# ## End(Not run)

Run the code above in your browser using DataLab