EmailMessage Sub-Object

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

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

https://restapi.surveygizmo.com/v4/survey/123456/surveycampaign/100000/emailmessage
ParametersExampleRequired
Authentication Credentialsapi_token=abcd12345&api_token_secret=abcd12345
True

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] => 465862
 [_type] => EmailMessage
 [_subtype] => message
 [messagetype] => plaintext
 [medium] => Email
 [invite_identity] => 282478
 [status] => Building
 [from] => Array
 (
 [email] => surveys@sgizmo.com
 [name] => Survey Research
 )

 [subject] => 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] => 
 )

 [sfootercopy] => This message was sent by [account("physical address")].
To unsubscribe, click below:
[invite("unsubscribe link")]
 [datecreated] => 2013-08-27 21:23:36
 [datemodified] => 2013-08-27 21:23:36
 )

 [1] => Array
 (
 [id] => 467617
 [_type] => EmailMessage
 [_subtype] => reminder
 [messagetype] => 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] => 
 )

 [sfootercopy] => This message was sent by [account("physical address")].
To unsubscribe, click below:
[invite("unsubscribe link")]
 [datecreated] => 2013-09-01 15:40:51
 [datemodified] => 2013-09-01 15:41:14
 )

 )

)

GET EMAILMESSAGE - Get information about a specified email message.

https://restapi.surveygizmo.com/v4/survey/123456/surveycampaign/100000/emailmessage/100000
ParametersExampleRequired
Authentication Credentialsapi_token=abcd12345&api_token_secret=abcd12345True

Response Example (.debug format):


Array
(
 [result_ok] => 1
 [total_count] => 1
 [page] => 1
 [total_pages] => 1
 [results_per_page] => 1
 [data] => Array
 (
 [0] => Array
 (
 [id] => 465862
 [_type] => EmailMessage
 [_subtype] => message
 [messagetype] => plaintext
 [medium] => Email
 [invite_identity] => 282478
 [status] => Building
 [from] => Array
 (
 [email] => surveys@sgizmo.com
 [name] => Survey Research
 )

 [subject] => 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] => 
 )

 [sfootercopy] => This message was sent by [account("physical address")].
To unsubscribe, click below:
[invite("unsubscribe link")]
 [datecreated] => 2013-08-27 21:23:36
 [datemodified] => 2013-08-27 21:23:36
 )

 )

)

CREATE EMAILMESSAGE - Create a new email message.

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/v4/survey/123456/surveycampaign/100000/emailmessage?_method=PUT
ParametersExampleRequired
Authentication Credentialsapi_token=abcd12345&api_token_secret=abcd12345
True
typemessage, reminderFalse
from[name]SurveyGizmoFalse
from[email]surveys@surveygizmo.comFalse
repliessurveys@surveygizmo.comFalse
subjectSubject TextFalse
messagetype*plaintext, htmlFalse
body[text]Body TextFalse
body[html]†Body HTMLFalse
send‡trueFalse
sfootercopyFooter 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 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
 [messagetype] => 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] => 
 )

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

)

UPDATE EMAILMESSAGE - Update a specified email message.

https://restapi.surveygizmo.com/v4/survey/123456/surveycampaign/100000/emailmessage/100000?_method=POST
ParametersExampleRequired
Authentication Credentialsapi_token=abcd12345&api_token_secret=abcd12345
True
from[name]SurveyGizmoFalse
from[email]surveys@surveygizmo.comFalse
repliessurveys@surveygizmo.comFalse
subjectSubject TextFalse
messagetype*plaintext, htmlFalse
body[text]Body TextFalse
body[html]†Body HTMLFalse
send‡trueFalse
sfootercopyFooter 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 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
 [messagetype] => 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] => 
 )

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

)

DELETE EMAILMESSAGE - Delete specified email message.

https://restapi.surveygizmo.com/v4/survey/123456/surveycampaign/100000/emailmessage/100000?_method=DELETE
ParametersExampleRequired
Authentication Credentialsapi_token=abcd12345&api_token_secret=abcd12345
True

Response Example (.debug format):


Array
(
 [result_ok] => 1
)