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 Schedule in SendGrid

 Overview

OperationDescription
addScheduleSchedule a delivery time for an existing Marketing Email.

getSchedule

Retrieve the scheduled delivery time for an existing Marketing  Email.

deleteSchedule

Cancel a scheduled send for a Marketing Email.

Operation details

This section provides details on the operations.

Adding a Schedule
The  addSchedule  operation schedules  a delivery time for an existing Marketing Email.

addSchedule
<sendgrid.addSchedule>
    <name>{$ctx:name}</name>
    <at>{$ctx:at}</at>
    <after>{$ctx:after}</after>
</sendgrid.addSchedule>

Properties

name : required - Marketing Email to schedule delivery for. (If Marketing  Email should be sent now, include no additional parameters.)

at: Date / Time to schedule marketing email Delivery.

after: Number  of minutes until delivery should occur.

 

Sample Request for addSchedule
{
  "apiUrl":"https://api.sendgrid.com/api/newsletter",
  "apiUser":"UserName",
  "apiKey":"PassWord",
  "name":"test"
}

Retrieves a schedule.
The  getSchedule  operation retrieves  the scheduled delivery time for an existing Marketing Email.

getSchedule
<sendgrid.getSchedule>
    <name>{$ctx:name}</name>
</sendgrid.getSchedule>

Properties

name: Required - Retrieve the delivery time scheduled for this Marketing  Email.

 

Sample Request for getSchedule
{
  "apiUrl":"https://api.sendgrid.com/api/newsletter",
  "apiUser":"UserName",
  "apiKey":"PassWord",
  "name":"test"
}

Delete a schedule

The  deleteSchedule  operation cancels  a scheduled send for a Marketing Email.

deleteSchedule
<sendgrid.deleteSchedule>
    <name>{$ctx:name}</name>
</sendgrid.deleteSchedule>

Properties

name: required - Remove the scheduled delivery time from an existing Marketing Email.

 

Sample Request for deleteSchedule
{
  "apiUrl":"https://api.sendgrid.com/api/newsletter",
  "apiUser":"UserName",
  "apiKey":"PassWord",
  "name":"test"
}

Sample configuration

Following is a sample proxy service that illustrates how to connect to SendGrid with the init operation and use the getSchedule operation. You can use this sample as a template for using other operations in this category.

Sample Proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="sendgrid_getSchedule"
       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.getSchedule>
    		<name>{$ctx:name}</name>
		</sendgrid.getSchedule>
   
           <respond/>
        </inSequence>
        <outSequence>
            <log/>
            <send/>
        </outSequence>
    </target>
    <description/>
</proxy>