mail. read_ watch
Fetch messages that arrived since the last check.
2 credits. Per call.
Example prompt
Send this to your AI app when Heelo is connected:
Tell me when a new email arrives
Input fields
| Field | Type | Description |
|---|---|---|
account_handle | string | Which configured mailbox to watch. |
folder | string | Folder to watch for new mail. |
cursor | string | Opaque cursor from the previous call. Optional: without it the watch resumes from the position saved by the last call for this mailbox, and only when there is none does it establish a baseline (returning no messages that first time). |
timeout_s | integer | Seconds to wait for new mail before returning empty (max 300). |
reset | boolean | Discard the saved position and start a new baseline from now. |
end_user_id | string | Optional end-user scope. |
Output fields
The fields in data when status is success.
| Field | Type |
|---|---|
account | object |
provider | string |
folder | string |
count | integer |
messages | array of object |
next_cursor | string |
rebuilt | boolean |
baseline_established | boolean |
resumed_from | string |
waited_s | integer |
untrusted | boolean |
Code
The call with the input fields that the tool needs. Set HEELO_API_KEY to your API key.
import os
import requests
response = requests.post(
"https://toolsprimitives.uk/v1/tools/mail.read_watch/invoke",
headers={"Authorization": f"Bearer {os.environ['HEELO_API_KEY']}"},
json={"input": {}},
timeout=120,
)
response.raise_for_status()
print(response.json())// Node.js 18 or newer, in an ES module.
const response = await fetch("https://toolsprimitives.uk/v1/tools/mail.read_watch/invoke", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.HEELO_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
input: {},
}),
signal: AbortSignal.timeout(120_000),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());