Dynamic Injection of Filters in Nylas API Sync

Summary

User seeks assistance in dynamically injecting domain filters and incremental sync cursors into the search_query_native parameter for syncing data from the Nylas API.


Question

Hello All,
Use Case: I am trying to dynamically inject both domain filters (from: to: cc: bcc:) and incremental sync cursors (after) into the search_query_native query parameter while syncing data from the Nylas API.

Could someone please help me inject these into search_query_native ?



This topic has been created from a Slack thread to give it more visibility.
It will be on Read-Only mode here. Click here if you want
to access the original thread.

Join the conversation on Slack

['nylas-api', 'search-query-native', 'domain-filters', 'incremental-sync', 'data-sync']

curl -X GET “https://api.us.nylas.com/v3/grants/26e180fa-c487-492f-8fc8-752122e850e5/messages?search_query_native=from:“{capitalone.com}”+OR+to:“{capitalone.com}”+OR+cc:“{capitalone.com}”+OR+bcc:“{capitalone.com}”+AND+after:220924800
-H “Authorization: Bearer YOUR_ACCESS_TOKEN”
Example:
search_query_native filters messages involving <http://capitalone.com|capitalone.com> in the from, to, cc, and bcc fields.
The after:220924800 ensures only messages after the date corresponding to the Unix timestamp 220924800 are retrieved.
need to inject them into search_query_native and after should be incremental date.

search_query_native is query parameter

Query Parameters:

Key: search_query_native
Value: from: “{{ stream_partition[‘domains’] }}” OR to: “{{ stream_partition[‘domains’] }}” OR cc: from: “{{ stream_partition[‘domains’] }}” OR bcc: from: “{{ stream_partition[‘domains’] }}” after: {{ stream_interval.start_time }}

Incremental Sync:

type: DatetimeBasedCursor
cursor_field: date
start_datetime:
type: MinMaxDatetime
datetime: ‘{{ config[“start_date”] }}’
datetime_format: ‘%s’
datetime_format: ‘%s’
cursor_datetime_formats:

  • ‘%s’

this how it looks like in the connector.

This is not working as expected. I guess this is not taking the user input ‘date’ for a new domain.

Firstly, I ran the Sync with just a domain (e.g., http://Capitalone.com|Capitalone.com) and it completed as expected. Second time, I gave other domains and then it didn’t load all the records. I believe it took the first Sync cursor date as an input date.

<@U047ANT3J84> If you get a chance, could you please look into it? This is quiet essential for our email integration. Thanks for your time.

Can you share more info about the API and how the request should be structured (e.g. an example via CURL of what you’re trying to achieve?)

curl -X GET “https://api.us.nylas.com/v3/grants/26e180fa-c487-492f-8fc8-752122e850e5/messages?search_query_native=from:“{capitalone.com}”+OR+to:“{capitalone.com}”+OR+cc:“{capitalone.com}”+OR+bcc:“{capitalone.com}”+AND+after:220924800
-H “Authorization: Bearer YOUR_ACCESS_TOKEN”
Example:
search_query_native filters messages involving <http://capitalone.com|capitalone.com> in the from, to, cc, and bcc fields.
The after:220924800 ensures only messages after the date corresponding to the Unix timestamp 220924800 are retrieved.
need to inject them into search_query_native and after should be incremental date.

search_query_native is query parameter

Query Parameters:

Key: search_query_native
Value: from: “{{ stream_partition[‘domains’] }}” OR to: “{{ stream_partition[‘domains’] }}” OR cc: from: “{{ stream_partition[‘domains’] }}” OR bcc: from: “{{ stream_partition[‘domains’] }}” after: {{ stream_interval.start_time }}

Incremental Sync:

type: DatetimeBasedCursor
cursor_field: date
start_datetime:
type: MinMaxDatetime
datetime: ‘{{ config[“start_date”] }}’
datetime_format: ‘%s’
datetime_format: ‘%s’
cursor_datetime_formats:

  • ‘%s’

this how it looks like in the connector.

This is not working as expected. I guess this is not taking the user input ‘date’ for a new domain.

Firstly, I ran the Sync with just a domain (e.g., http://Capitalone.com|Capitalone.com) and it completed as expected. Second time, I gave other domains and then it didn’t load all the records. I believe it took the first Sync cursor date as an input date.

<@U047ANT3J84> If you get a chance, could you please look into it? This is quiet essential for our email integration. Thanks for your time.