EmailMessage Sub-Object v5

 Help Us Improve Our API Documentation!

We're beginning an initiative to improve our API docs. We would love your help!

Please take this quick 4-question survey to help us out! Thank you in advance for your time!

The following API calls are currently available for the EmailMessage Sub-Object:

GET LIST - Get a list of all email messages for the specified survey and survey campaign.

https://restapi.surveygizmo.com/v5/survey/123456/surveycampaign/100000/emailmessage

Note: Get requests will cache for 60 seconds. If you make repeated API get requests that are identical, the return will be cached and will thus return identical results.
ParametersExampleRequired
Authentication Credentialsapi_token=5D685159B6964FB69B044D3E7D2676D1True
Response Example (.debug format):

Array
(
 [result_ok] => 1
 [total_count] => 2
 [page] => 1
 [total_pages] => 1
 [results_per_page] => 2
 [data] => Array
 (
 [0] => Array
 (
 [id] => 128073
 [subtype] => message
 [message_type] => html
 [medium] => Email
 [invite_identity] => 94135
 [status] => Building
 [from] => Array
 (
 [email] => surveys@sgizmo.com
 [name] => Survey Research
 )

 [subject] => Please take a moment to fill out this survey
 [body] => Array
 (
 [text] => Hi
I'm currently running a study. If you don't mind, please fill out this survey -- it should only take a few minutes.

[invite("survey link")]

Thank You!
						
 [html] => Hi

I'm currently running a study. If you don't mind, please fill out this survey -- it should only take a few minutes.


[invite("html link"), title="Begin"]


Thank You!

 )

 [footer] => This message was sent by [account("physical address")].
To unsubscribe, click below:
[invite("unsubscribe link")]
 [date_created] => 2014-07-29 11:25:54
 [date_modified] => 2016-05-24 14:53:33
 )

 [1] => Array
 (
 [id] => 147089
 [subtype] => reminder
 [message_type] => plaintext
 [medium] => Email
 [invite_identity] => 94135
 [status] => Building
 [from] => Array
 (
 [email] => surveys@sgizmo.com
 [name] => DaveDom
 )

 [subject] => Reminder: Please take a moment to fill out this survey
 [body] => Array
 (
 [text] => Hi
I'm currently running a study. If you don't mind, please fill out this survey -- it should only take a few minutes.

[invite("survey link")]

Thank You!
						
 [html] => Hi

I'm currently running a study. If you don't mind, please fill out this survey -- it should only take a few minutes.


[invite("html link"), title="Begin"]


Thank You!

 )

 [footer] => This message was sent by [account("physical address")].
To unsubscribe, click below:
[invite("unsubscribe link")]
 [date_created] => 2016-05-31 16:19:38
 [date_modified] => 2016-05-31 16:24:08
 )

 )

)

GET EMAILMESSAGE - Get information about a specific email message within a campaign.

https://restapi.surveygizmo.com/v5/survey/123456/surveycampaign/100000/emailmessage/100000?_method=GET

Note: Get requests will cache for 60 seconds. If you make repeated API get requests that are identical, the return will be cached and will thus return identical results.
ParametersExampleRequired
Authentication Credentials

api_token=5D685159B6964FB69B044D3E7D2676D1

True
Response Example (.debug format):

Array
(
 [result_ok] => 1
 [data] => Array
 (
 [id] => 128073
 [subtype] => message
 [message_type] => html
 [medium] => Email
 [invite_identity] => 94135
 [status] => Building
 [from] => Array
 (
 [email] => surveys@sgizmo.com
 [name] => Survey Research
 )

 [subject] => Please take our survey
 [body] => Array
 (
 [text] => Hi
I'm currently running a study. If you don't mind, please fill out this survey -- it should only take a few minutes.

[invite("survey link")]

Thank You!
						
 [html] => Hi

I'm currently running a study. If you don't mind, please fill out this survey -- it should only take a few minutes.


[invite("html link"), title="Begin"]


Thank You!

 )

 [footer] => This message was sent by [account("physical address")].
To unsubscribe, click below:
[invite("unsubscribe link")]
 [date_created] => 2014-07-29 11:25:54
 [date_modified] => 2016-05-24 14:53:33
 )

)

CREATE EMAILMESSAGE - Create a new email message within a campaign.

When creating campaigns via either the API or the UI, a default message is created. Before creating a message do a quick GET LIST to check for a default Invite Message.

https://restapi.surveygizmo.com/v5/survey/123456/surveycampaign/100000/emailmessage?_method=PUT

ParametersExampleRequired
Authentication Credentialsapi_token=5D685159B6964FB69B044D3E7D2676D1True
subtypemessage, reminderFalse
from[name]SurveyGizmoFalse
from[email]surveys@surveygizmo.comFalse
repliessurveys@surveygizmo.comFalse
subjectSubject TextFalse
message_type*plaintext, htmlFalse
body[text]Body TextFalse
body[html]†Body HTMLFalse
send‡trueFalse
footerFooter Text + [account("physical address")]False

*All messages created via the API are set to plaintext only. If you use the POST call to change the messagetype to html this will set your email to HTML with plaintext backup.
†Pro tip: If you set the messagetype=html the message will be set to send an html email with a plaintext backup that automatically syncs. This way you only have to specify the HTML body!
‡The send parameter will send the message when the call is made only if set to true. This parameter does not need to be set to false to prevent the message from sending.

Response Example (.debug format):

Array
(
 [result_ok] => 1
 [data] => Array
 (
 [id] => 123456
 [type] => EmailMessage
 [subtype] => reminder
 [message_type] => plaintext
 [medium] => Email
 [invite_identity] => 282478
 [status] => Building
 [from] => Array
 (
 [email] => surveys@sgizmo.com
 [name] => Survey Research
 )

 [subject] => [Reminder] Help out by taking this survey.
 [body] => Array
 (
 [text] => Hi
I'm currently running a study. If you don't mind, please fill out this survey -- it should only take a few minutes.

[invite("survey link")]

Thank You!
 [html] => Hi
I'm currently running a study. If you don't mind, pelase fill out this survey -- it should only take a few minutes.

[invite("html link"), title="Begin"]
 )

 [footer] => This message was sent by [account("physical address")].
To unsubscribe, click below:
[invite("unsubscribe link")]
 [date_created] => 2013-09-01 16:16:58
 [date_modified] => 2013-09-01 16:16:58
 )

)

UPDATE EMAILMESSAGE - Update a specific email message within a campaign.

https://restapi.surveygizmo.com/v5/survey/123456/surveycampaign/100000/emailmessage/100000?_method=POST

ParametersExampleRequired
Authentication Credentialsapi_token=5D685159B6964FB69B044D3E7D2676D1True
from[name]SurveyGizmoFalse
from[email]surveys@surveygizmo.comFalse
repliessurveys@surveygizmo.comFalse
subjectSubject TextFalse
message_type*plaintext, htmlFalse
body[text]Body TextFalse
body[html]†Body HTMLFalse
send‡trueFalse
footerFooter Text + [account("physical address")]False

*All messages created via the API are set to plaintext only. If you use the POST call to change the messagetype to html this will set your email to HTML with plaintext backup.
†Pro tip: If you set the messagetype=html the message  will be set to send an html email with a plaintext backup that automatically syncs. This way you only have to specify the HTML body!
‡The send parameter will send the message when the call is made only if set to true. This parameter does not need to be set to false to prevent the message from sending.

Response Example (.debug format):

Array
(
 [result_ok] => 1
 [data] => Array
 (
 [id] => 467633
 [type] => EmailMessage
 [subtype] => reminder
 [message_type] => plaintext
 [medium] => Email
 [invite_identity] => 282478
 [status] => Building
 [from] => Array
 (
 [email] => surveys@sgizmo.com
 [name] => Survey Research
 )

 [subject] => [Reminder] Help out by taking this survey.
 [body] => Array
 (
 [text] => Hi
I'm currently running a study. If you don't mind, please fill out this survey -- it should only take a few minutes.

[invite("survey link")]

Thank You!
 [html] => 
 )

 [footer] => This message was sent by [account("physical address")].
To unsubscribe, click below:
[invite("unsubscribe link")]
 [date_created] => 2013-09-01 16:16:58
 [date_modified] => 2013-09-01 16:25:39
 )

)

DELETE EMAILMESSAGE - Delete a specific email message from a campaign.

https://restapi.surveygizmo.com/v5/survey/123456/surveycampaign/100000/emailmessage/100000?_method=DELETE

ParametersExampleRequired
Authentication Credentialsapi_token=5D685159B6964FB69B044D3E7D2676D1True
Response Example (.debug format):

Array
(
 [result_ok] => 1
)