This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Working with Marketing Emails in SendGrid
 Overview
Operation | Description |
---|---|
addMarketingEmail | Create a new Marketing Email. |
editMarketingEmail | Edit an existing Marketing Email. |
getMarketingEmail | Retrieve the contents of an existing Marketing Email. |
listMarketingEmail | Retrieve a list of all existing Marketing Email. |
deleteMarketingEmail | Remove an existing Marketing Email. |
Operation details
This section provides details on the operations.
Adding a new marketing email
The addMarketingEmail operation creates a new Marketing Email.
<sendgrid.addMarketingEmail> <identity>{$ctx:identity}</identity> <name>{$ctx:name}</name> <subject>{$ctx:subject}</subject> <text>{$ctx:text}</text> <html>{$ctx:html}</html> </sendgrid.addMarketingEmail>
Properties
identity : Required - The Identity (Sender Address) that will be used for the Marketing Email being created.
name: Required - The name that will be used for the Marketing Email being created.
subject: Required - The subject that will be used for the Marketing Email being created.
text: Required - The text portion of the Marketing Email being created.
html: Required - The html portion of the Marketing Email being created.
Â
{ "apiUrl":"https://api.sendgrid.com/api/newsletter", "apiUser":"UserName", "apiKey":"PassWord", "identity":"Sender_Address", "name":"SendGrid_Test", "subject":"testSubject", "text":"testText", "html":"testHtml" }
Editing an existing marketing email
The editMarketingEmail operation edits an existing Marketing Email.
<sendgrid.editMarketingEmail> <identity>{$ctx:identity}</identity> <name>{$ctx:name}</name> <newname>{$ctx:newname}</newname> <subject>{$ctx:subject}</subject> <text>{$ctx:text}</text> <html>{$ctx:html}</html> </sendgrid.editMarketingEmail>
Properties
identity : Required - The Identity (Sender Address) that will be used for the Marketing Email being created.
name: Required - The name that will be used for the Marketing Email.
newname: The new name that will be used for the Marketing Email.
subject: Required - The subject that will be used for the Marketing Email.
text: Required - The text portion of the Marketing Email.
html: Required - The html portion of the Marketing Email.
Â
{ "apiUrl":"https://api.sendgrid.com/api/newsletter", "apiUser":"UserName", "apiKey":"PassWord", "identity":"Sender_Address", "name":"SendGrid_Test", "newname":"SendGridTestNewName", Â "subject":"testSubject", "text":"testText", "html":"testHtml" }
Retrieving contents of marketing email
The getMarketingEmail operation retrieve the contents of an existing Marketing Email.
<sendgrid.getMarketingEmail> <name>{$ctx:name}</name> </sendgrid.getMarketingEmail>
Properties
name: Required - Retrieve the content of an existing Marketing Email.
Â
{ "apiUrl":"https://api.sendgrid.com/api/newsletter", "apiUser":"UserName", "apiKey":"PassWord", "name":"SendGrid_Test" }
Retrieve a list of all existing Marketing Email.
The listMarketingEmail operation retrieves a list of all existing Marketing Email.
<sendgrid.listMarketingEmail> <name>{$ctx:name}</name> </sendgrid.listMarketingEmail>
Properties
name: Required - Search to see if a specific Marketing Email exists rather than a list of all Marketing Emails.
Â
{ "apiUrl":"https://api.sendgrid.com/api/newsletter", "apiUser":"UserName", "apiKey":"PassWord", "name":"SendGrid_Test" }
Remove an existing Marketing Email.
The deleteMarketingEmail operation remove an existing Marketing Email.
<sendgrid.deleteMarketingEmail> <name>{$ctx:name}</name> </sendgrid.deleteMarketingEmail>
Properties
name: Required - Remove the Marketing Email with this name.
Â
{ "apiUrl":"https://api.sendgrid.com/api/newsletter", "apiUser":"UserName", "apiKey":"PassWord", "name":"SendGrid_Testnew" }
Sample configuration
Following is a sample proxy service that illustrates how to connect to SendGrid with the init
operation and use the listMarketingEmail operation. You can use this sample as a template for using other operations in this category.
<?xml version="1.0" encoding="UTF-8"?> <proxy xmlns="http://ws.apache.org/ns/synapse" name="sendgrid_listMarketingEmail" transports="https,http" statistics="disable" trace="disable" startOnLoad="true"> <target> <inSequence> <property name="apiUrl" expression="json-eval($.apiUrl)"/> <property name="apiUser" expression="json-eval($.apiUser)"/> <property name="apiKey" expression="json-eval($.apiKey)"/> <property name="name" expression="json-eval($.name)"/> <sendgrid.init> <apiUrl>{$ctx:apiUrl}</apiUrl> <apiUser>{$ctx:apiUser}</apiUser> <apiKey>{$ctx:apiKey}</apiKey> </sendgrid.init> <sendgrid.listMarketingEmail> <name>{$ctx:name}</name> </sendgrid.listMarketingEmail> <respond/> </inSequence> <outSequence> <log/> <send/> </outSequence> </target> <description/> </proxy>