From c3d8e1e64c6e76e528f569531c170a199c9e3811 Mon Sep 17 00:00:00 2001 From: Eric Gustin Date: Mon, 5 May 2025 16:47:48 -0700 Subject: [PATCH] Add docs for ListEmailsByProperty tool --- .../productivity/microsoft/outlook_mail.mdx | 59 ++++++++++++++++++- ...st_emails_by_property_example_call_tool.js | 34 +++++++++++ ...st_emails_by_property_example_call_tool.py | 31 ++++++++++ ...list_emails_by_property_example_llm_oai.js | 22 +++++++ ...list_emails_by_property_example_llm_oai.py | 21 +++++++ 5 files changed, 166 insertions(+), 1 deletion(-) create mode 100644 public/examples/integrations/toolkits/microsoft/outlook_mail/list_emails_by_property_example_call_tool.js create mode 100644 public/examples/integrations/toolkits/microsoft/outlook_mail/list_emails_by_property_example_call_tool.py create mode 100644 public/examples/integrations/toolkits/microsoft/outlook_mail/list_emails_by_property_example_llm_oai.js create mode 100644 public/examples/integrations/toolkits/microsoft/outlook_mail/list_emails_by_property_example_llm_oai.py diff --git a/pages/toolkits/productivity/microsoft/outlook_mail.mdx b/pages/toolkits/productivity/microsoft/outlook_mail.mdx index bc2910c6..53f734cb 100644 --- a/pages/toolkits/productivity/microsoft/outlook_mail.mdx +++ b/pages/toolkits/productivity/microsoft/outlook_mail.mdx @@ -38,6 +38,7 @@ These tools are currently available in the Arcade Sheets toolkit. ["ReplyAllToEmail", "Reply to all recipients of an existing email in Outlook."], ["ListEmails", "List emails in the user's mailbox across all folders."], ["ListEmailsInFolder", "List the user's emails in the specified folder."], + ["ListEmailsByProperty", "List emails in the user's mailbox across all folders filtering by a property."] ]} /> @@ -305,6 +306,39 @@ Exactly one of `well_known_folder_name` or `folder_id` MUST be provided. --- +## ListEmailsByProperty + +List emails in the user's mailbox across all folders filtering by a property. + +**Parameters** + +- **`property`** (enum ([EmailFilterProperty](#emailfilterproperty)), required): The property to filter the emails by. +- **`operator`** (enum ([FilterOperator](#filteroperator)), required): The operator to use for the filter +- **`value`** (string, required): The value to filter the emails by. +- **`limit`** (int, optional): The number of messages to return. Max is 100. Defaults to 5. +- **`pagination_token`** (str, optional): The pagination token to continue a previous request + + + +--- + ## Auth The Arcade Outlook Mail toolkit uses the [Microsoft auth provider](/home/auth-providers/microsoft) to connect to users' Microsoft accounts. @@ -337,4 +371,27 @@ The type of reply to send to an email. - **`REPLY`** _(string: "reply")_ - **`REPLY_ALL`** _(string: "reply_all")_ - \ No newline at end of file + + +### EmailFilterProperty + +The property to filter the emails by. + +- **`SUBJECT`** _(string: "subject")_ +- **`CONVERSATION_ID`** _(string: "conversationId")_ +- **`RECEIVED_DATE_TIME`** _(string: "receivedDateTime")_ +- **`SENDER`** _(string: "sender/emailAddress/address")_ + +### FilterOperator + +The operator to use for the filter. + +- **`EQUAL`** _(string: "eq")_ +- **`NOT_EQUAL`** _(string: "ne")_ +- **`GREATER_THAN`** _(string: "gt")_ +- **`GREATER_THAN_OR_EQUAL_TO`** _(string: "ge")_ +- **`LESS_THAN`** _(string: "lt")_ +- **`LESS_THAN_OR_EQUAL_TO`** _(string: "le")_ +- **`STARTS_WITH`** _(string: "startsWith")_ +- **`ENDS_WITH`** _(string: "endsWith")_ +- **`CONTAINS`** _(string: "contains")_ diff --git a/public/examples/integrations/toolkits/microsoft/outlook_mail/list_emails_by_property_example_call_tool.js b/public/examples/integrations/toolkits/microsoft/outlook_mail/list_emails_by_property_example_call_tool.js new file mode 100644 index 00000000..ec1c90b1 --- /dev/null +++ b/public/examples/integrations/toolkits/microsoft/outlook_mail/list_emails_by_property_example_call_tool.js @@ -0,0 +1,34 @@ +import { Arcade } from "@arcadeai/arcadejs"; + +const client = new Arcade(); // Automatically finds the `ARCADE_API_KEY` env variable + +const USER_ID = "you@example.com"; +const TOOL_NAME = "Microsoft.ListEmailsByProperty"; + +// Start the authorization process +const authResponse = await client.tools.authorize({ + tool_name: TOOL_NAME, + user_id: USER_ID, +}); + +if (authResponse.status !== "completed") { + console.log(`Click this link to authorize: ${authResponse.url}`); +} + +// Wait for the authorization to complete +await client.auth.waitForCompletion(authResponse); + +const toolInput = { + property: "sender", + operator: "contains", + value: "arcade.dev", + limit: 10, +}; + +const response = await client.tools.execute({ + tool_name: TOOL_NAME, + input: toolInput, + user_id: USER_ID, +}); + +console.log(response); diff --git a/public/examples/integrations/toolkits/microsoft/outlook_mail/list_emails_by_property_example_call_tool.py b/public/examples/integrations/toolkits/microsoft/outlook_mail/list_emails_by_property_example_call_tool.py new file mode 100644 index 00000000..f29a3fbb --- /dev/null +++ b/public/examples/integrations/toolkits/microsoft/outlook_mail/list_emails_by_property_example_call_tool.py @@ -0,0 +1,31 @@ +from arcadepy import Arcade + +client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variable + +USER_ID = "you@example.com" +TOOL_NAME = "Microsoft.ListEmailsByProperty" + +auth_response = client.tools.authorize( + tool_name=TOOL_NAME, + user_id=USER_ID, +) + +if auth_response.status != "completed": + print(f"Click this link to authorize: {auth_response.url}") + +# Wait for the authorization to complete +client.auth.wait_for_completion(auth_response) + +tool_input = { + "property": "sender", + "operator": "contains", + "value": "arcade.dev", + "limit": 10, +} + +response = client.tools.execute( + tool_name=TOOL_NAME, + input=tool_input, + user_id=USER_ID, +) +print(response) diff --git a/public/examples/integrations/toolkits/microsoft/outlook_mail/list_emails_by_property_example_llm_oai.js b/public/examples/integrations/toolkits/microsoft/outlook_mail/list_emails_by_property_example_llm_oai.js new file mode 100644 index 00000000..70e38beb --- /dev/null +++ b/public/examples/integrations/toolkits/microsoft/outlook_mail/list_emails_by_property_example_llm_oai.js @@ -0,0 +1,22 @@ +import OpenAI from 'openai'; + +const USER_ID = "you@example.com"; +const PROMPT = "List 10 emails from anyone from the domain 'arcade.dev'"; +const TOOL_NAME = "Microsoft.ListEmailsByProperty"; + +const client = new OpenAI({ + baseURL: 'https://api.arcade.dev', + apiKey: process.env.ARCADE_API_KEY +}); + +const response = await client.chat.completions.create({ + messages: [ + { role: 'user', content: PROMPT } + ], + model: 'gpt-4o-mini', + user: USER_ID, + tools: [TOOL_NAME], + tool_choice: 'generate' +}); + +console.log(response.choices[0].message.content); diff --git a/public/examples/integrations/toolkits/microsoft/outlook_mail/list_emails_by_property_example_llm_oai.py b/public/examples/integrations/toolkits/microsoft/outlook_mail/list_emails_by_property_example_llm_oai.py new file mode 100644 index 00000000..9f9d6537 --- /dev/null +++ b/public/examples/integrations/toolkits/microsoft/outlook_mail/list_emails_by_property_example_llm_oai.py @@ -0,0 +1,21 @@ +import os +from openai import OpenAI + +USER_ID = "you@example.com" +PROMPT = "List 10 emails from anyone from the domain 'arcade.dev'" +TOOL_NAME = "Microsoft.ListEmailsByProperty" + +client = OpenAI( + base_url="https://api.arcade.dev", api_key=os.environ.get("ARCADE_API_KEY") +) + +response = client.chat.completions.create( + messages=[ + {"role": "user", "content": PROMPT}, + ], + model="gpt-4o-mini", + user=USER_ID, + tools=[TOOL_NAME], + tool_choice="generate", +) +print(response.choices[0].message.content)