Create Email Message
Create a new email message within a survey campaign.
Note: When a campaign is created (via API or UI), a default invite message is automatically generated. Before creating a new message, do a List Email Messages call to check whether a default message already exists.
Endpoint
PUT
/v5/survey/{survey_id}/surveycampaign/{campaign_id}/emailmessage
Authentication is required for all requests. See Authentication.
Path Parameters
survey_id
integer
required
The ID of the survey that owns the campaign.
campaign_id
integer
required
The ID of the survey campaign to add the message to.
Request Body
All parameters are optional.
subtype
string
The message subtype. Accepted values:
message, reminder.from
object
The sender details.
child attributes
name
string
The sender display name (e.g.,
Alchemer).email
string
The sender email address (e.g.,
surveys@alchemer.com).replies
string
The reply-to email address.
subject
string
The subject line of the email.
message_type
string
The message format. Accepted values:
plaintext, html. All messages created via the API default to plaintext. Setting this to html enables an HTML email with an automatically syncing plaintext backup -- you only need to provide the HTML body.body
object
The email body content.
child attributes
text
string
The plain-text body of the email.
html
string
The HTML body of the email. Used when
message_type is set to html.send
boolean
Set to
true to send the message immediately when the call is made. Omitting it is sufficient to prevent sending.footer
string
The footer text appended to the message.
embed_question
boolean
Set to
true to embed the first survey question in the body of the email.disable_styles
boolean
Set to
true to disable the default email message styles.Response
result_ok
boolean
Returns
true if the email message was created successfully.data
object
The newly created email message object.
child attributes
id
string
The ID of the newly created email message.
type
string
Always
EmailMessage.subtype
string
The message subtype:
message or reminder.message_type
string
The message format:
html or plaintext.medium
string
The delivery medium. Always
Email.invite_identity
string
The internal ID linking the message to its campaign invitation.
status
string
The current send status of the message (e.g.,
Building).from
object
The sender details.
child attributes
email
string
The sender email address.
name
string
The sender display name.
subject
string
The email subject line.
body
object
The email body content.
child attributes
text
string
The plain-text body.
html
string
The HTML body.
footer
string
The message footer text.
embed_question
boolean
Whether the first survey question is embedded in the email body.
disable_styles
boolean
Whether default email styles are disabled.
date_created
string
The date and time the message was created.
date_modified
string
The date and time the message was last modified.
Examples
Request
curl -X PUT "https://api.alchemer.com/v5/survey/123456/surveycampaign/100000/emailmessage?api_token=YOUR_API_TOKEN&api_token_secret=YOUR_API_TOKEN_SECRET" \ --data-urlencode "subtype=reminder" \ --data-urlencode "subject=Reminder: Please take our survey" \ --data-urlencode "from[name]=Alchemer" \ --data-urlencode "from[email]=surveys@alchemer.com" \ --data-urlencode "body[text]=Hi, please fill out this survey."
Response
{
"result_ok": true,
"data": {
"id": "123456",
"type": "EmailMessage",
"subtype": "reminder",
"message_type": "plaintext",
"medium": "Email",
"invite_identity": "282478",
"status": "Building",
"from": {
"email": "surveys@alchemer.com",
"name": "Alchemer"
},
"subject": "Reminder: Please take our survey",
"body": {
"text": "Hi, please fill out this survey.",
"html": ""
},
"footer": "This message was sent by [account(\"physical address\")].",
"embed_question": false,
"disable_styles": false,
"date_created": "2013-09-01 16:16:58",
"date_modified": "2013-09-01 16:16:58"
}
}