MarketingCampaigns
Create, update, delete, and query Marketing Campaigns in SendGrid.
Table-Specific Information
Select
This table only supports filtering by Id. The following are the only possible SELECT queries:
SELECT * FROM MarketingCampaigns SELECT * FROM MarketingCampaigns WHERE Id = '1'
Insert
The following columns are required in an insert: Title, Subject, SenderId, ListIds, SegmentIds, Categories, SuppressionGroupId, HtmlContent, and PlainContent.
Note that a CustomUnsubscribeUrl can be used in place of a SuppressionGroupId. However, SendGrid highly recommends to use SuppressionGroupId.
Use the check points below to find the SenderId and SuppressionGroupId inputs:
- To find the SenderId, navigate to Marketing -> MarketingCampaigns -> Senders. Create a new sender if you do not have one already. Then click the gear on the Action column and select Edit. The Id is displayed on the navigation bar after /senders/id.
- To find the SuppressionGroupId, insert into the UnsubscribeGroups table; the created Id is the SuppressionGroupId.
INSERT INTO MarketingCampaigns (Title, Subject, SenderId, ListIds, Categories, SuppressionGroupId, HtmlContent, PlainContent) VALUES ('Test Campaign', 'March Newsletter', '123', '1,2', 'fruits, health', '12', '<b>Eat Healthy</b>', 'Eat healthy')
Update
You can only update MarketingCampaigns by specifying an Id.
UPDATE MarketingCampaigns SET PlainContent = 'Eat healthier' WHERE Id = '123'
Delete
You can only delete from MarketingCampaigns by specifying an Id.
DELETE FROM MarketingCampaigns WHERE Id = '123'
Columns
Name | Type | ReadOnly | References | Description |
Id [KEY] | String | True |
The Id of the marketing campaign. | |
Title | String | False |
The title of the marketing campaign. | |
Subject | String | False |
The subject of the marketing campaign. | |
SenderId | Integer | False |
The sender Ids of the marketing campaign, separated by a comma. | |
ListIds | String | False |
The list of list Ids of the marketing campaign, separated by a comma. | |
SegmentIds | String | False |
The list of segment Ids of the marketing campaign, separated by a comma. | |
Categories | String | False |
The categories of the marketing campaign. | |
SuppressionGroupId | Integer | False |
The suppression group Id of the marketing campaign. | |
CustomUnsubscribeUrl | String | False |
The custom unsubscribe URL of the marketing campaign. | |
IpPool | String | False |
The IP pool of the marketing campaign. | |
HtmlContent | String | False |
The HTML content of the marketing campaign. | |
PlainContent | String | False |
The content of the marketing campaign. | |
Status | String | True |
The status of the marketing campaign. | |
Editor | String | False |
The editor used in the UI. The allowed values are code, design. |