Skip to main content

Data Source

Follow the instructions below to create a new data flow that ingests data from a SendGrid source in Nexla.
sendgrid_api.png

SendGrid

Create a New Data Flow

  1. To create a new data flow, navigate to the Integrate section, and click the New Data Flow button. Then, select the desired flow type from the list, and click the Create button.

  2. Select the SendGrid connector tile from the list of available connectors. Then, select the credential that will be used to connect to your SendGrid account, and click Next; or, create a new SendGrid credential for use in this flow.

  3. In Nexla, SendGrid data sources can be created using pre-built endpoint templates, which expedite source setup for common SendGrid endpoints. Each template is designed specifically for the corresponding SendGrid endpoint, making source configuration easy and efficient.
    • To configure this source using a template, follow the instructions in Configure Using a Template.

    SendGrid sources can also be configured manually, allowing you to ingest data from SendGrid endpoints not included in the pre-built templates or apply further customizations to exactly suit your needs.
    • To configure this source manually, follow the instructions in Configure Manually.

Configure Using a Template

Nexla provides pre-built templates that can be used to rapidly configure data sources to ingest data from common SendGrid endpoints. Each template is designed specifically for the corresponding SendGrid endpoint, making data source setup easy and efficient.

Endpoint Settings

  • Select the endpoint from which this source will fetch data from the Endpoint pulldown menu. Available endpoint templates are listed in the expandable boxes below. Click on an endpoint to see more information about it and how to configure your data source for this endpoint.

    Get User Profile

    This endpoint template retrieves your SendGrid user profile information from your SendGrid account. Use this template when you need to retrieve information about your SendGrid account, including account details, user information, and other profile metadata.

    • This endpoint automatically retrieves your SendGrid user profile from your SendGrid account. No additional configuration is required beyond selecting this endpoint template.

    This endpoint returns your SendGrid user profile information, including account details, user information, and other profile metadata. Use this endpoint to retrieve information about your SendGrid account.

    For detailed information about user profiles, API response structures, and available profile data, see the SendGrid API documentation.

    Get Daily Global Email Stats

    This endpoint template retrieves all of your global email statistics since yesterday from your SendGrid account. Use this template when you need to retrieve daily email statistics, including delivery rates, open rates, click rates, and other email performance metrics.

    • This endpoint automatically retrieves your global email statistics since yesterday from your SendGrid account. The endpoint uses the {now-1} macro to calculate yesterday's date automatically.

    This endpoint returns all of your global email statistics since yesterday from your SendGrid account, including delivery rates, open rates, click rates, and other email performance metrics. The endpoint automatically calculates yesterday's date using the {now-1} macro.

    For detailed information about email statistics, API response structures, and available metrics, see the SendGrid API documentation.

    Global Email Stats For Date Range

    This endpoint template retrieves all of your global email statistics between a given date range from your SendGrid account. Parent accounts will see aggregated stats for their account and all subuser accounts. Subuser accounts will only see their own stats. Use this template when you need to retrieve email statistics for a specific date range.

    • Enter the start date in the Start Date field. This should be the start date for the date range in the format YYYY-MM-DD (e.g., 2024-01-01). The start date determines the beginning of the date range for which statistics will be retrieved.
    • Enter the end date in the End Date field. This should be the end date for the date range in the format YYYY-MM-DD (e.g., 2024-01-31). The end date determines the end of the date range for which statistics will be retrieved.

    This endpoint returns all of your global email statistics between a given date range from your SendGrid account, including delivery rates, open rates, click rates, and other email performance metrics. Parent accounts will see aggregated stats for their account and all subuser accounts. Subuser accounts will only see their own stats.

    For detailed information about email statistics, API response structures, date range queries, and available metrics, see the SendGrid API documentation.

    Get Marketing Campaigns

    This endpoint template retrieves all marketing campaigns with pagination support from your SendGrid account. Use this template when you need to retrieve information about marketing campaigns, including campaign IDs, names, and other campaign metadata.

    • Enter the page size in the Page Size field. This should be the number of campaigns to retrieve per page. The page size determines how many campaigns will be returned in each API request.

    This endpoint returns all marketing campaigns from your SendGrid account, including campaign IDs, names, and other campaign metadata. The endpoint uses next token-based pagination with page_token to handle large datasets efficiently. Nexla will automatically fetch subsequent pages of data by following the next page token returned in the API response.

    For detailed information about marketing campaigns, API response structures, pagination, and available campaign data, see the SendGrid API documentation.

    Get Contacts

    This endpoint template retrieves all contacts with custom fields from your SendGrid account. Use this template when you need to retrieve information about contacts, including contact IDs, email addresses, and other contact metadata.

    • Enter the page size in the Page Size field. This should be the number of contacts to retrieve per page. The page size determines how many contacts will be returned in each API request.

    This endpoint returns all contacts from your SendGrid account, including contact IDs, email addresses, and other contact metadata. The endpoint uses next token-based pagination with page_token to handle large datasets efficiently. Nexla will automatically fetch subsequent pages of data by following the next page token returned in the API response.

    For detailed information about contacts, API response structures, pagination, and available contact data, see the SendGrid API documentation.

    Get Verified Senders

    This endpoint template retrieves all verified sender identities from your SendGrid account. Use this template when you need to retrieve information about verified senders, including sender IDs, email addresses, and other sender metadata.

    • This endpoint automatically retrieves all verified sender identities from your SendGrid account. No additional configuration is required beyond selecting this endpoint template.

    This endpoint returns all verified sender identities from your SendGrid account, including sender IDs, email addresses, and other sender metadata. Use this endpoint to discover which senders are verified in your SendGrid account.

    For detailed information about verified senders, API response structures, and available sender data, see the SendGrid API documentation.

Endpoint Testing

Once the selected endpoint template has been configured, Nexla can retrieve a sample of the data that will be fetched according to the current settings. This allows users to verify that the source is configured correctly before saving.

  • To test the current endpoint configuration, click the Test button to the right of the endpoint selection menu. Sample data will be fetched & displayed in the Endpoint Test Result panel on the right.

  • If the sample data is not as expected, review the selected endpoint and associated settings, and make any necessary adjustments. Then, click the Test button again, and check the sample data to ensure that the correct information is displayed.

Configure Manually

SendGrid data sources can be manually configured to ingest data from any valid SendGrid API endpoint. Manual configuration provides maximum flexibility for accessing endpoints not covered by pre-built templates or when you need custom API configurations.

With manual configuration, you can also create more complex SendGrid sources, such as sources that use chained API calls to fetch related data or sources that require custom query parameters or filters.

API Method

  1. To manually configure this source, select the Advanced tab at the top of the configuration screen.

  2. Select the API method that will be used for calls to the SendGrid API from the Method pulldown menu. SendGrid API typically uses GET method for retrieving data from endpoints.

API Endpoint URL

  1. Enter the URL of the SendGrid API endpoint from which this source will fetch data in the Set API URL field. This should be the complete URL to your SendGrid endpoint (e.g., https://api.sendgrid.com/v3/user/profile, https://api.sendgrid.com/v3/stats). Include any required query parameters in the URL.

Ensure the API endpoint URL is correct and accessible with your current credentials. The SendGrid API endpoint URL should include the API version (/v3/) and the resource type path. You can test the endpoint using the Test button after configuring the URL.

Response Data Path

  1. Enter the JSONPath expression in the Response Data Path field to specify which part of the API response should be treated as the relevant data by Nexla. For SendGrid API responses, use $ to extract the entire response for single record endpoints, $[*] to extract all items from the response array, or $.result[*] to extract all items from the result array, depending on your endpoint.

The JSONPath expression must correctly reference the structure of your SendGrid API response. SendGrid API responses may have different structures depending on the endpoint. Ensure your JSONPath expression matches the structure returned by your specific endpoint. The JSONPath expression determines which data will be extracted and processed by Nexla.

Pagination (if applicable)

  1. If your endpoint supports pagination, configure the pagination settings in the Pagination section. SendGrid API uses different pagination mechanisms for different endpoints (next token-based, offset-based, etc.). Select the pagination type that matches your endpoint's pagination mechanism.

  2. Configure the pagination parameters based on your selected pagination type. For next token-based pagination, specify the token parameter name (page_token) and the JSONPath expression to the next page token in the response ($._metadata.next). For offset-based pagination, specify the offset parameter name (offset), page size parameter name (limit), and starting offset value.

Save the Data Source

  1. Once all of the relevant steps in the above sections have been completed, click the Next button to proceed with the rest of the data flow configuration, or click Save to save the data source configuration for later use.