Create email message

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.
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.
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.

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"
  }
}