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 Recipients in SendGrid
 Overview
Operation | Description |
---|---|
Assign a List to a Marketing Email. | |
Get all lists assigned to a particular marketing email. | |
Remove assigned lists from marketing email. |
Operation details
This section provides details on the operations.
Add a new Recipient
The addRecipient operation assigns a list to a Marketing Email.
<sendgrid.addRecipient> <list>{$ctx:list}</list> <name>{$ctx:name}</name> </sendgrid.addRecipient>
Properties
list:Â Required -The name of the list to assign to the marketing email.
name: Required - The name of the marketing email.
Â
{ "apiUrl":"https://api.sendgrid.com/api/newsletter", "apiUser":"UserName", "apiKey":"PassWord", "name":"test", Â "name":"SendGrid_Testnew" }
Get list of recipient
The getRecipient operation gets all list lists assigned to a particular marketing email.
<sendgrid.getRecipient> <name>{$ctx:name}</name> </sendgrid.getRecipient>
Properties
name:Â Required - The name of the marketing email for which to retrieve lists.
Â
{ "apiUrl":"https://api.sendgrid.com/api/newsletter", "apiUser":"UserName", "apiKey":"PassWord", Â "name":"SendGrid_Testnew" }
Delete a list from marketing email
The deleteRecipient operation removes assigned lists from marketing email.
<sendgrid.deleteRecipient> <name>{$ctx:name}</name> <list>{$ctx:list}</list> </sendgrid.deleteRecipient>
Properties
list:Â Â Required - To marketing email from which the list will be unassigned.
name:Â Required -Remove this list from the marketing email.
Â
{ "apiUrl":"https://api.sendgrid.com/api/newsletter", "apiUser":"UserName", "apiKey":"PassWord", Â "name":"SendGrid_Testnew", "list":"test" }
Sample configuration
Following is a sample proxy service that illustrates how to connect to SendGrid with the init
operation and use the addRecipient 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_addRecipient" 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="list" expression="json-eval($.list)"/> <property name="name" expression="json-eval($.name)"/> <sendgrid.init> <apiUrl>{$ctx:apiUrl}</apiUrl> <apiUser>{$ctx:apiUser}</apiUser> <apiKey>{$ctx:apiKey}</apiKey> </sendgrid.init> <sendgrid.addRecipient> <list>{$ctx:list}</list> <name>{$ctx:name}</name> </sendgrid.addRecipient> <respond/> </inSequence> <outSequence> <log/> <send/> </outSequence> </target> <description/> </proxy>