Messages
Query Email Activities in SendGrid.
NOTE: If you want access to Email activities, you must purchase the Email Activity History add-in of SendGrid. If using a Restricted Access key, you must give it the messages.read and email_activity.read scopes.
View-Specific Information
Select
The add-in will use the SendGrid API to process WHERE clause conditions built with the following column and operator. The rest of the filter is executed client side within the add-in.Note: The API will return only 1000 records. Please choose from the available filters to restrict the search.
- Id supports the '=,IN' comparisons.
- Status supports the '=,!=,LIKE,NOT LIKE' comparisons.
- Subject supports the '=,!=,LIKE,NOT LIKE' comparisons.
- FromEmail supports the '=,!=,LIKE,NOT LIKE' comparisons.
- ToEmail supports the '=,!=,LIKE,NOT LIKE' comparisons.
- Clicks supports the '>,<,<=,>=,=,!=' comparisons.
- LastEventTime supports the '>=, <=, BETWEEN' comparisons.
- ApiKeyId supports the '=,!=,LIKE,NOT LIKE' comparisons.
- AsmGroupId supports the '=,!=,LIKE,NOT LIKE' comparisons.
- MarketingCampaignId supports the '=,!=,LIKE,NOT LIKE' comparisons.
- MarketingCampaignName supports the '=,!=,LIKE,NOT LIKE' comparisons.
- OriginatingIp supports the '=,!=,LIKE,NOT LIKE' comparisons.
- OutboundIp supports the '=,!=,LIKE,NOT LIKE' comparisons.
- Teammate supports the '=,!=,LIKE,NOT LIKE' comparisons.
- TemplateId supports the '=,!=,LIKE,NOT LIKE' comparisons.
For example, the following queries are processed server side:
SQL
SELECT * FROM Messages WHERE Id = '1234'
SELECT * FROM Messages WHERE Id IN ('1234', '4567')
SELECT * FROM Messages WHERE Status = 'not_delivered'
SELECT * FROM Messages WHERE LastEventTime BETWEEN '2020-01-01' AND '2020-01-15'
NOTE: Pagination is not available on this view. Any query—whether filtered or not—will return a maximum of 1000 records. If your filtered query matches more than 1000 records, only the first 1000 will be returned.
Columns
| Name | Type | References | Description |
| Id [KEY] | String | The Id of the message. | |
| Status | String | Status of the email. | |
| Subject | String | Subject of the email. | |
| FromEmail | String | The email of the sender. | |
| ToEmail | String | The email of the receiver. | |
| ClicksCount | Integer | The number of clicks. | |
| OpensCount | Integer | The number of times that the email was opened. | |
| LastEventTime | Datetime | The datetime of the event. | |
| ApiKeyId | String | Id of the API Key. | |
| AsmGroupId | String | ASM Group Id. | |
| MarketingCampaignId | String | The id of the marketing campaign. | |
| MarketingCampaignName | String | The name of the marketing campaign. | |
| MarketingCampaignSplitId | String | Split id of the campaign. | |
| MarketingCampaignVersion | String | Version of the campaign. | |
| OriginatingIp | String | This is the IP address of the person sending the message | |
| OutboundIp | String | This is the SendGrid dedicated IP address used to send the email | |
| OutboundIpType | String | The type of the outbound IP. | |
| Teammate | String | Username of the teammate. | |
| TemplateId | String | Template ID of the email. | |
| Events | String | List of events related to email message in SendGrid. |