### Test Python SDK Installation Source: https://developer.nylas.com/docs/v3/sdks/python.md Make a request to retrieve application information to test the Python SDK installation and setup. This example prints the Application ID. ```python from nylas import Client nylas = Client( "", "", ) application = nylas.applications.info() application_id = application[1] print("Application ID:", application_id) ``` -------------------------------- ### Install and Initialize Nylas CLI Source: https://developer.nylas.com/docs/v3/notifications/receive-webhooks-cli.md Install the Nylas CLI using curl and authenticate with your API key to get started. ```bash curl -fsSL https://cli.nylas.com/install.sh | bash nylas init ``` -------------------------------- ### Service Account GET Request Example Source: https://developer.nylas.com/docs/v3/auth/nylas-service-account.md Execute a GET request using service account authentication. Ensure the PRIVATE_KEY_B64, REQUEST_PATH, and NYLAS_KID environment variables are set. ```bash PRIVATE_KEY_B64="$(cat private_key_b64.txt)" \ REQUEST_PATH="/v3/admin/domains" \ NYLAS_KID="08d8bdae-9981-432c-ac66-3006919d908e" \ go run domain.go ``` -------------------------------- ### Setup Script for Nylas CLI Installation Source: https://developer.nylas.com/docs/cookbook/cli/manus-skill.md This bash script installs the Nylas CLI by downloading a pre-built binary, placing it in the system's PATH, and configuring authentication using an API key. It includes architecture detection for Linux amd64 and arm64. ```bash #!/usr/bin/env bash set -euo pipefail ARCH="$(uname -m)" case "$ARCH" in x86_64) TAG="linux_amd64" ;; aarch64|arm64) TAG="linux_arm64" ;; *) echo "Unsupported arch: $ARCH"; exit 1 ;; esac # Fetch latest release curl -fsSL "https://github.com/nylas/cli/releases/latest/download/nylas_${TAG}.tar.gz" \ | tar -xz -C /tmp # Install on PATH if [ -w /usr/local/bin ]; then mv /tmp/nylas /usr/local/bin/nylas else mkdir -p "$HOME/.local/bin" mv /tmp/nylas "$HOME/.local/bin/nylas" export PATH="$HOME/.local/bin:$PATH" fi # Configure auth if [ -z "${NYLAS_API_KEY:-}" ]; then read -rp "Nylas API key: " NYLAS_API_KEY fi nylas auth config --api-key "$NYLAS_API_KEY" # Verify nylas auth whoami ``` -------------------------------- ### Test SDK Installation: Get Application Details (Java) Source: https://developer.nylas.com/docs/v3/sdks/kotlin-java.md This Java code snippet demonstrates how to test your Nylas SDK installation by fetching your Nylas application's details. Ensure you replace `` with your actual API key. ```java import com.nylas.NylasClient; import com.nylas.models.*; public class getApplication { public static void main(String[] args) throws NylasSdkTimeoutError, NylasApiError { NylasClient nylas = new NylasClient.Builder("").build(); Response application = nylas.applications().getDetails(); System.out.println(application); } } ``` -------------------------------- ### Create a Session using Ruby SDK Source: https://developer.nylas.com/docs/reference/api/sessions/post-sessions.md This Ruby example demonstrates creating a scheduling session using the Nylas SDK. Ensure you have the Nylas gem installed and provide your API key. ```ruby # Load gems require 'nylas' # Initialize Nylas client nylas = Nylas::Client.new( api_key: "" ) request_body = { "configuration_id": "", "time_to_live": 30 } session, _request_ids = nylas.scheduler.sessions.create(request_body: request_body) puts session ``` -------------------------------- ### Scheduling Agent Tutorial - Webhook Setup Source: https://developer.nylas.com/docs/changelogs/2026-04-16-agent-accounts-beta This snippet represents the initial webhook setup for a scheduling agent. It's part of a larger tutorial demonstrating end-to-end use cases. ```bash # Example webhook configuration (details omitted for brevity) # This would typically involve setting up a webhook endpoint and registering it with Nylas. ``` -------------------------------- ### Java SDK - Get Free/Busy Source: https://developer.nylas.com/docs/reference/api/calendar/post-calendars-free-busy.md Example of how to retrieve free/busy time slots using the Java SDK. It covers client setup, creating the `GetFreeBusyRequest` object with start time, end time, and email list, and processing the response. ```APIDOC ## Java SDK - Get Free/Busy ### Description Retrieve free/busy time slots for specified email accounts within a given time range using the Java SDK. ### Method `nylas.calendars().getFreeBusy(grant_id, request)` ### Parameters #### Path Parameters - **grant_id** (string) - Required - The identifier of the grant. #### Request Body - **request** (GetFreeBusyRequest) - Required - An object containing the request parameters. - **startTime** (integer) - Required - The Unix timestamp for the start of the time range. - **endTime** (integer) - Required - The Unix timestamp for the end of the time range. - **emails** (List) - Required - A list of email addresses to check for free/busy status. ### Request Example ```java List emails = new ArrayList<>(); emails.add(""); GetFreeBusyRequest request = new GetFreeBusyRequest(startTime, endTime, emails); Response> response = nylas.calendars(). getFreeBusy("", request); ``` ### Response #### Success Response (200) - **response** (Response>) - Contains the free/busy information for the requested emails. ``` -------------------------------- ### Start Customer Onboarding Flow (Python) Source: https://developer.nylas.com/docs/cookbook/use-cases/automate/automate-customer-onboarding.md Initiates the complete onboarding sequence for a new customer. This includes saving customer data, creating a scheduling page, sending a welcome email, updating the onboarding state, and scheduling a follow-up check. ```python def start_onboarding(customer): # 1. Create the customer record save_customer_record(customer["email"], { "name": customer["name"], "email": customer["email"], "onboarding_state": "new", "created_at": time.time(), }) # 2. Create a per-customer scheduling page scheduler = create_kickoff_scheduler() scheduling_url = ( f"https://book.nylas.com/{scheduler.slug}" f"?name={customer['name']}&email__readonly={customer['email']}" ) # 3. Send the welcome email customer["scheduling_url"] = scheduling_url send_welcome_email(customer) # 4. Update state transition_to(customer["email"], "welcome_sent") # 5. Schedule a follow-up check after 48 hours schedule_followup_check(customer["email"], delay_hours=48) ``` -------------------------------- ### Start Local Development Server Source: https://developer.nylas.com/docs/v3/getting-started/scheduler.md Run a local development server from your project root. Replace `` with your desired port number. ```bash npx serve --listen ``` ```bash npm run dev -- --port ``` -------------------------------- ### Get Connector using Java SDK Source: https://developer.nylas.com/docs/reference/api/connectors-integrations/get_connector_by_provider.md Retrieve a connector using the Nylas Java SDK. This example shows the setup for the `NylasClient` and the call to the `find` method for a specific provider. Note the use of `AuthProvider.GOOGLE`. ```java import com.nylas.NylasClient; import com.nylas.models.*; public class ListDraft { public static void main(String[] args) throws NylasSdkTimeoutError, NylasApiError { NylasClient nylas = new NylasClient.Builder("").build(); Response connector = nylas.connectors().find(AuthProvider.GOOGLE); System.out.println(connector); } } ``` -------------------------------- ### Start Customer Onboarding Flow (Node.js) Source: https://developer.nylas.com/docs/cookbook/use-cases/automate/automate-customer-onboarding.md Initiates the complete onboarding sequence for a new customer. This includes saving customer data, creating a scheduling page, sending a welcome email, updating the onboarding state, and scheduling a follow-up check. ```javascript async function startOnboarding(customer) { // 1. Create the customer record await saveCustomerRecord(customer.email, { name: customer.name, email: customer.email, onboardingState: "new", createdAt: new Date().toISOString(), }); // 2. Create a per-customer scheduling page const scheduler = await createKickoffScheduler(); const schedulingUrl = `https://book.nylas.com/${scheduler.slug}?name=${encodeURIComponent(customer.name)}&email__readonly=${encodeURIComponent(customer.email)}`; // 3. Send the welcome email customer.schedulingUrl = schedulingUrl; await sendWelcomeEmail(customer); // 4. Update state await transitionTo( { email: customer.email, onboardingState: "new" }, "welcome_sent", { welcomeSentAt: new Date().toISOString() }, ); // 5. Schedule a follow-up check after 48 hours await scheduleFollowUpCheck(customer.email, 48); } ``` -------------------------------- ### Get Calendar by ID using Ruby SDK Source: https://developer.nylas.com/docs/reference/api/calendar/get-calendars-id.md Fetch a calendar using the Nylas Ruby SDK. This example initializes the client and calls the `find` method on the calendars object. Ensure you have the `nylas` gem installed. ```ruby require 'nylas' nylas = Nylas::Client.new(api_key: "") calendar, _request_ids = nylas.calendars.find( identifier: "", calendar_id: "" ) puts calendar ``` -------------------------------- ### Full example: Reply to a message - Kotlin Source: https://developer.nylas.com/docs/v3/sdks/kotlin-java/send-email.md A complete Kotlin example demonstrating how to reply to a message. It includes fetching the thread, creating the draft, and sending the reply. ```kotlin fun main(args: Array) { val nylas: NylasClient = NylasClient(apiKey = "") val queryParams = ListThreadsQueryParams(limit = 1, inFolder = Collections.singletonList("inbox")) val threads : List = nylas.threads().list("", queryParams).data val len : Int? = threads[0].messageIds?.size val reply = len?.minus(1)?.let { threads[0].messageIds?.get(it) } val requestBody = CreateDraftRequest.Builder(). replyToMessageId(reply). subject(threads[0].subject). build() val draft = nylas.drafts().create("", requestBody) val msg = nylas.drafts().send( dotenv["NYLAS_GRANT_ID"], draft.data.id ) } ``` -------------------------------- ### Get Calendar using Kotlin SDK Source: https://developer.nylas.com/docs/v3/calendar.md Fetch a calendar's details using the Nylas Kotlin SDK. This example includes the required imports, client setup, and the method call to retrieve calendar data. ```kotlin import com.nylas.NylasClient import com.nylas.models.* fun main(args: Array) { val nylas: NylasClient = NylasClient(apiKey = "") val calendar: Response = nylas.calendars().find("", "") println("Id: " + calendar.data.id + " | Name: " + calendar.data.name + " | Description: " + calendar.data.description) } ``` -------------------------------- ### Full example: Reply to a message - Java Source: https://developer.nylas.com/docs/v3/sdks/kotlin-java/send-email.md A complete Java example demonstrating how to reply to a message. It includes fetching the thread, creating the draft, and sending the reply. ```java public class ReadThreadParameters { public static void main(String[] args) throws NylasSdkTimeoutError, NylasApiError { NylasClient nylas = new NylasClient.Builder("").build(); ListThreadsQueryParams queryParams = new ListThreadsQueryParams.Builder(). limit(1). inFolder(Collections.singletonList("inbox")). build(); ListResponse thread = nylas.threads().list("", queryParams); assert thread.getData().get(0).getMessageIds() != null; int len = thread.getData().get(0).getMessageIds().size() - 1; String reply = thread.getData().get(0).getMessageIds().get(len); CreateDraftRequest request_body = new CreateDraftRequest.Builder(). replyToMessageId(reply). subject(thread.getData().get(0).getSubject()). build(); Response draft = nylas.drafts().create("", request_body); Response msg = nylas.drafts().send("", draft.getData().getId()); } } ``` -------------------------------- ### Test SDK Installation: Get Application Details (Kotlin) Source: https://developer.nylas.com/docs/v3/sdks/kotlin-java.md This Kotlin code snippet verifies your Nylas SDK setup by retrieving your application's details. Remember to substitute `` with your valid Nylas API key. ```kotlin import com.nylas.NylasClient fun main(args: Array) { val nylas: NylasClient = NylasClient( apiKey = "" ) val application = nylas.applications().getDetails() print(application) } ``` -------------------------------- ### Ruby SDK - Get Free/Busy Source: https://developer.nylas.com/docs/reference/api/calendar/post-calendars-free-busy.md Example of how to retrieve free/busy time slots using the Ruby SDK. It demonstrates client initialization, setting up the request body with email addresses, start and end times, and calling the `get_free_busy` method. ```APIDOC ## Ruby SDK - Get Free/Busy ### Description Retrieve free/busy time slots for specified email accounts within a given time range using the Ruby SDK. ### Method `nylas.calendars.get_free_busy(identifier:, request_body:)` ### Parameters #### Path Parameters - **identifier** (string) - Required - The identifier of the grant. #### Request Body - **emails** (array of strings) - Required - A list of email addresses to check for free/busy status. - **start_time** (integer) - Required - The Unix timestamp for the start of the time range. - **end_time** (integer) - Required - The Unix timestamp for the end of the time range. ### Request Example ```ruby request_body = { "emails": [ "" ], "start_time": start_time, "end_time": end_time } available, _request_ids = nylas.calendars.get_free_busy(identifier: "", request_body: request_body) ``` ### Response #### Success Response (200) - **available** (array) - Contains the free/busy information for the requested emails. ``` -------------------------------- ### Full Example: Create and Send Email (Java) Source: https://developer.nylas.com/docs/v3/sdks/kotlin-java/send-email.md A complete Java example demonstrating how to initialize the Nylas client, create a draft with recipients, subject, and body, and then send the draft. ```java public class CreateDraft { public static void main(String[] args) throws NylasSdkTimeoutError, NylasApiError { NylasClient nylas = new NylasClient.Builder("").build(); CreateDraftRequest requestBody = new CreateDraftRequest.Builder(). to(Collections.singletonList(new EmailName("swag@example.com", "Nylas"))). subject("With Love, from Nylas"). body("This email was sent using the Nylas Email API. Visit https://nylas.com for details."). build(); Response drafts = nylas.drafts().create("", requestBody); System.out.println("Draft " + drafts.getData().getSubject() + " was created with ID " + drafts.getData().getId()); nylas.drafts().send("", drafts.getData().getId()); } } ``` -------------------------------- ### Python SDK - Get Free/Busy Source: https://developer.nylas.com/docs/reference/api/calendar/post-calendars-free-busy.md Example of how to retrieve free/busy time slots using the Python SDK. It shows how to initialize the client, specify the grant ID, and construct the request body with start time, end time, and email addresses. ```APIDOC ## Python SDK - Get Free/Busy ### Description Retrieve free/busy time slots for specified email accounts within a given time range using the Python SDK. ### Method `nylas.calendars.get_free_busy(grant_id, request_body)` ### Parameters #### Path Parameters - **grant_id** (string) - Required - The identifier of the grant. #### Request Body - **start_time** (integer) - Required - The Unix timestamp for the start of the time range. - **end_time** (integer) - Required - The Unix timestamp for the end of the time range. - **emails** (array of strings) - Required - A list of email addresses to check for free/busy status. ### Request Example ```python free_busy = nylas.calendars.get_free_busy( grant_id, request_body={ "start_time":1630435200, "end_time":1630521600, "emails":[email] } ) ``` ### Response #### Success Response (200) - **free_busy** (object) - Contains the free/busy information for the requested emails. ``` -------------------------------- ### Full Example: Create Email Draft (Kotlin) Source: https://developer.nylas.com/docs/v3/sdks/kotlin-java/send-email.md A complete Kotlin example demonstrating how to initialize the Nylas client, construct a draft request body, and create the draft. ```kt fun main(args: Array) { val nylas: NylasClient = NylasClient(apiKey = "") val requestBody = CreateDraftRequest.Builder(). subject("With Love, from Nylas"). body("This email was sent using the Nylas Email API. Visit https://nylas.com for details."). to(listOf(EmailName("swag@example.com", "Nylas"))). build() val draft = nylas.drafts().create("", requestBody).data } ``` -------------------------------- ### Meeting Follow-up Workflow Example Source: https://developer.nylas.com/docs/v3/getting-started/agent-notetaker.md A multi-step workflow demonstrating how to integrate calendar events, notetaker transcripts, and email for meeting follow-ups. ```bash # 1. List today's calendar events to find meetings that happened nylas calendar events list --days 1 --json ``` ```bash # 2. Check which notetakers have finished recording curl -s --request GET \ --url "https://api.us.nylas.com/v3/grants/$NYLAS_GRANT_ID/notetakers" \ --header "Authorization: Bearer $NYLAS_API_KEY" \ | jq '.data[] | select(.status == "completed")' ``` ```bash # 3. Get the transcript curl -s --request GET \ --url "https://api.us.nylas.com/v3/grants/$NYLAS_GRANT_ID/notetakers//media" \ --header "Authorization: Bearer $NYLAS_API_KEY" ``` ```bash # 5. Send follow-up email with meeting summary nylas email send \ --to "team@example.com" \ --subject "Meeting notes: Q3 planning" \ --body "Here are the key decisions and action items from today..." \ --yes ``` -------------------------------- ### Get Free/Busy Information - Ruby SDK Source: https://developer.nylas.com/docs/reference/api/calendar/post-calendars-free-busy.md Utilize the Ruby SDK to fetch free/busy status. This example calculates the start and end times for the current day and queries availability for a specified email address. The output displays available time slots. ```ruby # Load gems require 'nylas' require 'date' # Initialize Nylas client nylas = Nylas::Client.new( api_key: "" ) # Get today’s date today = Date.today # When do we start and end searching for availability start_time = Time.local(today.year, today.month, today.day, 8, 0,0).strftime("%s").to_i end_time = Time.local(today.year, today.month, today.day, 17, 0,0).strftime("%s").to_i # Body of our request request_body = { "emails": [ "" ], "start_time": start_time, "end_time": end_time } # Call the get_availability endpoint available, _request_ids = nylas.calendars.get_free_busy(identifier: "", request_body: request_body) # Display available spots available.each {|time_slots| time_slots[:time_slots].each {|slots| puts "From: #{Time.at(slots[:start_time]).to_datetime.strftime("%H:%M:%S")}" \ "To: #{Time.at(slots[:end_time]).to_datetime.strftime("%H:%M:%S")}" } } ``` -------------------------------- ### Create Folder using Kotlin SDK Source: https://developer.nylas.com/docs/v3/email/folders.md This Kotlin SDK example demonstrates creating a folder. Ensure the NylasClient is initialized with your API key. ```kotlin fun main(args: Array) { val nylas: NylasClient = NylasClient(apiKey = dotenv["NYLAS_API_KEY"]) val request = CreateFolderRequest("My Custom label") val label = nylas.folders().create(dotenv["NYLAS_GRANT_ID"], request) print(label) } ``` -------------------------------- ### Get Workflow by ID Source: https://developer.nylas.com/docs/reference/api/application-level-workflows/get-workflow.md This example demonstrates how to retrieve a workflow using its ID via a GET request. ```APIDOC ## GET /v3/workflows/{workflow_id} ### Description Returns the specified application-level workflow. ### Method GET ### Endpoint https://api.us.nylas.com/v3/workflows/{workflow_id} ### Parameters #### Path Parameters - **workflow_id** (string) - Required - The ID of the workflow to access. ### Request Example ```bash curl --request GET \ --url "https://api.us.nylas.com/v3/workflows/" \ --header 'Accept: application/json' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' ``` ### Response #### Success Response (200) - **request_id** (string) - Required - The ID of the request. - **data** (object) - Required - A custom workflow that sends messages from a template when certain events are triggered. - **app_id** (string,null) - The ID of the Nylas application associated with the workflow. Returned only if the workflow is configured at the application level. - **date_created** (integer) - Required - When the workflow was created, in seconds using the Unix timestamp format. - **delay** (integer) - Required - The number of minutes between a `trigger_event` being met and the workflow sending a message. - **grant_id** (string,null) - The ID of the grant associated with the workflow. Returned only if the workflow is configured at the grant level. - **id** (string) - Required - The ID of the workflow. - **is_enabled** (boolean) - Required - When `true`, indicates that the workflow is enabled. - **name** (string) - Required - The name of the workflow. - **template_id** (string) - Required - The ID of the email template the workflow uses. - **trigger_event** (string) - Required - The event which triggers the workflow. - **from** (object,null) - Details of the sender if the workflow uses transactional send. #### Response Example ```json { "request_id": "string", "data": { "app_id": "string", "date_created": 1678886400, "delay": 5, "grant_id": "string", "id": "string", "is_enabled": true, "name": "string", "template_id": "string", "trigger_event": "string", "from": {} } } ``` #### Error Response (400) - **request_id** (string) - The request ID. - **error** (object) - The response error object. - **type** (string) - The error type. - **message** (string) - The error message. - **provider_error** (object) - The error from the provider. ``` -------------------------------- ### Create Folders and Labels Source: https://developer.nylas.com/docs/v3/sdks/node/manage-folders-labels.md This example shows how to create a new folder and then apply it to a specific message. It first creates the folder and then updates the message to include the newly created folder. ```APIDOC ## Create Folders and Labels ### Description Creates a new folder and optionally applies it to a message. ### Method `create` (for folders), `update` (for messages) ### Parameters #### Folder Creation Parameters - **identifier** (string) - Required - The grant ID of the user. - **requestBody** (object) - Required - The folder details. - **name** (string) - Required - The name of the folder. #### Message Update Parameters - **identifier** (string) - Required - The grant ID of the user. - **messageId** (string) - Required - The ID of the message to update. - **requestBody** (object) - Required - The update details. - **folders** (array) - Required - An array of folder IDs to associate with the message. ### Request Example ```javascript const NylasConfig = { apiKey: "", apiUri: "", }; const nylas = new Nylas(NylasConfig); const identifier = ""; const messageId = ""; let folderId = ""; const createFolder = async () => { try { const folder = await nylas.folders.create({ identifier, requestBody: { name: "Cat Pics!", }, }); console.log("Folder created:", folder); folderId = folder.data.id; } catch (error) { console.error("Error creating folder:", error); } }; const updateMessageFolder = async () => { try { const updatedMessage = await nylas.messages.update({ identifier, messageId, requestBody: { folders: [folderId], }, }); console.log("Message updated:", updatedMessage); } catch (error) { console.error("Error updating message folder:", error); } }; await createFolder(); await updateMessageFolder(); ``` ### Response #### Success Response (200) - **data** (object) - The created folder or updated message object. - **request_id** (string) - The ID of the request. #### Response Example (Folder Creation) ```json { "data": { "id": "folder-456", "name": "Cat Pics!", "parent_folder_id": null }, "request_id": "req-fghij" } ``` #### Response Example (Message Update) ```json { "data": { "id": "", "folders": ["folder-456"] }, "request_id": "req-klmno" } ``` ``` -------------------------------- ### Install Nylas CLI Skill Source: https://developer.nylas.com/docs/v3/getting-started/cli-for-agents.md Install the Nylas CLI skill for faster setup. This teaches your agent every CLI command, flag, and output shape. ```bash npx skills add nylas/skills/nylas-cli ``` ```bash /plugin marketplace add nylas/skills /plugin install nylas-skills ``` -------------------------------- ### Set Up Single Sign-On (SSO) Source: https://developer.nylas.com/docs/v3/auth/nylas-connect.md Integrate SSO support into your project by checking for an existing session on application load. If a session exists, initialize the app; otherwise, display a login button. ```typescript // Check for existing session on app load const session = await nylasConnect.getSession(); if (session) { // User is already authenticated, proceed to app initializeApp(session.grantInfo); } else { // Show login button showLoginButton(); } ``` -------------------------------- ### Inbox Triage Workflow Example Source: https://developer.nylas.com/docs/v3/getting-started/agent-email.md An example workflow for an agent to triage an inbox, including getting unread messages, reading important ones, replying, and marking as processed. ```bash # 1. Get unread messages nylas email list --unread --limit 20 --json # 2. Read the full content of a message that looks important nylas email read --json # 3. (Agent classifies the message using its LLM) # 4. Reply to urgent messages nylas email send \ --to "sender@example.com" \ --subject "Re: Server outage" \ --body "Looking into this now. Will update within the hour." \ --yes # 5. Mark processed messages as read nylas email mark read ``` -------------------------------- ### List Configurations using Kotlin SDK Source: https://developer.nylas.com/docs/reference/api/configurations/get-configurations.md This Kotlin example demonstrates how to fetch scheduling configurations using the Nylas SDK. It initializes the client and calls the list method to retrieve configurations. ```kotlin import com.nylas.NylasClient fun main() { val nylas = NylasClient.Builder("").build() val configurations = nylas.scheduler().configurations().list("") println("Configurations: ${configurations.data}") } ``` -------------------------------- ### Get Calendar Response Example Source: https://developer.nylas.com/docs/v3/calendar.md This is an example of the JSON response you will receive when successfully fetching calendar data. It includes details like grant ID, name, timezone, and color. ```json { "request_id": "123-456-789", "data": { "grant_id": "", "description": "Board game nights!", "id": "zd08j9stfph95u449vti", "is_primary": false, "name": "Game nights", "object": "calendar", "read_only": false, "timezone": "UTC", "hex_color": "#a47ae2", "hex_foreground_color": "#000000", "is_owned_by_user": true } } ``` -------------------------------- ### Recipe: Sign Agent Up for Third-Party Service Source: https://developer.nylas.com/docs/changelogs/2026-04-16-agent-accounts-beta This recipe provides a guide on how to sign up an agent account for a third-party service. It outlines the necessary steps and considerations. ```bash # Example code for signing up an agent (details omitted for brevity) # This would involve interacting with the third-party service's API or web interface. ``` -------------------------------- ### Create Project Files (HTML) Source: https://developer.nylas.com/docs/v3/getting-started/scheduler.md Use these commands to create the necessary HTML files for your project when using the Web components (HTML) path. ```bash mkdir nylas-scheduler/ cd nylas-scheduler/ touch index.html touch scheduler-editor.html ``` -------------------------------- ### Response for Get Attachment Metadata Source: https://developer.nylas.com/docs/v3/email/attachments.md This is an example of the JSON response when retrieving attachment metadata. ```json { "request_id": "5fa64c92-e840-4357-86b9-2aa123456789", "data": { "content_type": "image/png; name=\"pic.png\"", "filename": "pic.png", "grant_id": "", "content_id": "185e56cb50e12e82", "size": 13068, "content_id": "" } } ``` -------------------------------- ### Get Virtual Calendar Availability Source: https://developer.nylas.com/docs/v3/calendar/virtual-calendars.md Use the Get Availability endpoint to retrieve availability information for a virtual calendar. This example shows how to specify participants, time ranges, and availability rules. ```bash curl --request POST \ --url "https://api.us.nylas.com/v3/calendars/availability" \ --header 'Accept: application/json' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ \ "participants": [{ \ "email": "Nyla-virtual-account", \ "calendar_ids": ["primary"], \ "open_hours": [{ \ "days": [0,1,2], \ "timezone": "America/Toronto", \ "start": "9:00", \ "end": "17:00", \ "exdates": [] \ }] \ }], \ "start_time": 1600890600, \ "end_time": 1600999200, \ "interval_minutes": 30, \ "duration_minutes": 30, \ "round_to": 15, \ "availability_rules": { \ "availability_method": "max-availability", \ "buffer": { \ "before": 15, \ "after": 15 \ }, \ "default_open_hours": [ \ { \ "days": [0,1,2], \ "timezone": "America/Toronto", \ "start": "9:00", \ "end": "17:00", \ "exdates": [] \ }, \ { \ "days": [3,4,5], \ "timezone": "America/Toronto", \ "start": "10:00", \ "end": "18:00", \ "exdates": [] \ } \ ] \ } \ }' ``` -------------------------------- ### List Configurations using Ruby SDK Source: https://developer.nylas.com/docs/reference/api/configurations/get-configurations.md This Ruby example demonstrates how to fetch scheduling configurations using the Nylas SDK and iterate through the results to print their ID and slug. ```ruby # Load gems require 'nylas' # Initialize Nylas client nylas = Nylas::Client.new( api_key: "" ) # Get a list of configurations configurations, _request_ids = nylas.scheduler.configurations.list(identifier: "") # Loop the configurations configurations.each {|configuration| puts("ID: #{configuration[:id]} | Slug: #{configuration[:slug]}") } ``` -------------------------------- ### List Configurations using Node.js SDK Source: https://developer.nylas.com/docs/reference/api/configurations/get-configurations.md This Node.js example demonstrates how to list all scheduling configurations for a grant using the Nylas SDK. It includes error handling for the API request. ```javascript import Nylas from "nylas"; const nylas = new Nylas({ apiKey: "", apiUri: "", }); async function listConfigurations() { try { const configurations = await nylas.scheduler.configurations.list({ identifier: "", }); console.log("Configurations:", configurations); } catch (error) { console.error("Error listing configurations:", error); } } listConfigurations(); ``` -------------------------------- ### Get a Contact Source: https://developer.nylas.com/docs/reference/api/contacts/get-contact.md This example demonstrates how to retrieve a contact by specifying the grant ID and contact ID. ```APIDOC ## GET /v3/grants/{grant_id}/contacts/{contact_id} ### Description Return a contact by ID. ### Method GET ### Endpoint `https://api.us.nylas.com/v3/grants/{grant_id}/contacts/{contact_id}` ### Parameters #### Query Parameters - **select** (string) - Optional - Specify fields that you want Nylas to return, as a comma-separated list (for example, `select=id,updated_at`). This allows you to receive only the portion of object data that you're interested in. You can use `select` to optimize response size and reduce latency by limiting queries to only the information that you need. - **profile_picture** (boolean) - Optional - If `true` and `picture_url` is present, the response includes a Base64 binary data blob that you can use to view information as an image file (for example, a JPEG). #### Path Parameters - **grant_id** (string) - Required - ID of the grant to access. Use `/me/` to refer to the grant associated with an access token. - **contact_id** (string) - Required - ID of the contact to access. Nylas recommends you URL-encode this field, or you might receive a [`404` error](/docs/api/errors/400-response/) if the ID contains special characters (for example, `#`). ### Responses #### Success Response (200) - **request_id** (string) - The request ID. - **data** (object) - **birthday** (string) - The contact's birthday in [ISO-8601 format](https://en.wikipedia.org/wiki/ISO_8601#Calendar_dates). - **company_name** (string) - The name of the company that the contact is affiliated with (for example, their workplace). - **emails** (array,null) - The contact's email addresses. May be `null` if the contact has no email addresses. Treat `null` the same as an empty array. - **given_name** (string) - The contact's given name. - **grant_id** (string) - The ID of grant for the connected user. - **groups** (array,null) - The contact's group memberships. May be `null` if the contact has no group memberships. Treat `null` the same as an empty array. - **id** (string) - A globally unique object identifier for Microsoft accounts. An email address for Google accounts. - **im_addresses** (array,null) - The contact's IM addresses. May be `null` if the contact has no IM addresses. Treat `null` the same as an empty array. - **job_title** (string) - The contact's occupation or job title. - **manager_name** (string) - The name of the contact's manager. - **middle_name** (string) - The contact's middle name. - **nickname** (string) - A custom nickname for the contact. - **notes** (string) - Notes about with the contact (for example, their favorite food). - **object** (string) - The response object type. - **office_location** (string) - The location of the office where the contact works. - **phone_numbers** (array,null) - The contact's phone numbers. May be `null` if the contact has no phone numbers. Treat `null` the same as an empty array. - **physical_addresses** (array,null) - The contact's physical addresses. May be `null` if the contact has no physical addresses. Treat `null` the same as an empty array. - **picture_url** (string) - A URL that links to the contact's picture. - **source** (string) - The source of the contact. For iCloud and IMAP grants, the source is `inbox` if the contact is parsed from a message. If the contact is created or updated using the Nylas API, its source is `address_book`. - **suffix** (string) - (Not supported for EWS) The suffix of a contact's name, if applicable. - **surname** (string) - The contact's surname. - **web_pages** (array,null) - The contact's web pages. May be `null` if the contact has no web pages. Treat `null` the same as an empty array. - **picture** (string) - The contact's picture, represented as a Base64-encoded string. #### Error Responses - **400 - Bad Request** - **request_id** (string) - The request ID. - **error** (object) - The response error object. - **type** (string) - The error type. - **message** (string) - The error message. - **provider_error** (object) - The error from the provider. - **401 - Unauthorized** - **request_id** (string) - The request ID. - **error** (object) - The response error object. - **type** (string) - The error type. - **message** (string) - The error message. - **provider_error** (object) - The error from the provider. - **404 - Not Found** - **request_id** (string) - The request ID. - **error** (object) - The response error object. - **type** (string) - The error type. - **message** (string) - The error message. - **provider_error** (object) - The raw error from the provider, if available - **code** (string) - **message** (string) - **429 - Rate Limit** - **request_id** (string) - The request ID. - **error** (object) - The response error object. - **type** (string) - The error type. - **message** (string) - The error message. ``` -------------------------------- ### Get Event Response with Conferencing Details Source: https://developer.nylas.com/docs/v3/calendar/add-conferencing.md This is an example JSON response from Nylas when a `Get Event` request is made and conferencing details are available. The `conferencing` object contains the provider and meeting details. ```json { "request_id": "cbd60372-df33-41d3-b203-169ad5e3AAAA", "data": [ { "busy": true, "calendar_id": "primary", "conferencing": { "details": { "meeting_code": "ist-****-tcz", "url": "https://meet.google.com/ist-****-tcz" }, "provider": "Google Meet" }, "created_at": 1701974804, "creator": { "email": "anna.molly@example.com", "name": "" }, "description": null, "grant_id": "1e3288f6-124e-405d-a13a-635a2ee54eb2", "hide_participants": false, "html_link": "https://www.google.com/calendar/event?eid=NmE0dXIwabQAAAA", "ical_uid": "6aaaaaaame8kpgcid6hvd0q@google.com", "id": "6aaaaaaame8kpgcid6hvd", "object": "event", "organizer": { "email": "anna.molly@example.com", "name": "" }, "participants": [ { "email": "jenna.doe@example.com", "status": "yes" }, { "email": "anna.molly@example.com", "status": "yes" } ], "read_only": true, "reminders": { "overrides": null, "use_default": true }, "status": "confirmed", "title": "Holiday check in", "updated_at": 1701974915, "when": { "end_time": 1701978300, "end_timezone": "America/Los_Angeles", "object": "timespan", "start_time": 1701977400, "start_timezone": "America/Los_Angeles" } } ] } ``` -------------------------------- ### Create Folder Response Source: https://developer.nylas.com/docs/v3/email/folders.md Example JSON response when a folder or label is successfully created. ```json { "request_id": "1", "data": { "id": "Label_10", "grant_id": "", "name": "new folder", "total_count": 0, "unread_count": 0, "system_folder": false, "text_color": "#000000", "background_color": "#73AFFF" } } ``` -------------------------------- ### Get Webhook by ID using Ruby SDK Source: https://developer.nylas.com/docs/reference/api/webhook-notifications/get-webhook-by-id.md Use the Nylas Ruby SDK to get a webhook destination by its ID. This example covers initializing the client and invoking the `find` method for webhooks. ```ruby require 'nylas' nylas = Nylas::Client.new( api_key: "" ) webhook = nylas.webhooks.find(webhook_id: "") puts webhook ``` -------------------------------- ### Initialize Nylas SDK and Send Draft Source: https://developer.nylas.com/docs/v3/sdks/node/send-email.md This example shows how to initialize the Nylas SDK with your API credentials and grant ID, then create and send an email draft. Ensure you have installed and set up the SDK and authenticated a user beforehand. ```javascript const NylasConfig = { apiKey: "", apiUri: "", }; const nylas = new Nylas(NylasConfig); const identifier = ""; const createAndSendDraft = async () => { const draft = { subject: "With Love, from Nylas", to: [{ name: "My Nylas Friend", email: "devrel@nylas.com" }], body: "This email was sent using the Nylas Email API. Visit https://nylas.com for details.", }; const { id: draftId } = await nylas.drafts.create({ identifier, requestBody: draft, }); const message = await nylas.drafts.send({ identifier, draftId }); }; createAndSendDraft(); ``` -------------------------------- ### Get Application Details using Java SDK Source: https://developer.nylas.com/docs/reference/api/applications/get_application.md This Java example demonstrates how to get application details using the Nylas Java SDK. Build the `NylasClient` with your API key and then call `getDetails` on the applications object. ```java import com.nylas.NylasClient; import com.nylas.models.*; public class getApplication { public static void main(String[] args) throws NylasSdkTimeoutError, NylasApiError { NylasClient nylas = new NylasClient.Builder("").build(); Response application = nylas.applications().getDetails(); System.out.println(application); } } ```