imessage
Send an iMessage from Agency code via the macOS Messages app. Works on macOS only, with Messages.app signed in to iMessage. No API key required.
ts
import { sendIMessage } from "std::messaging/imessage"
node main() {
const result = sendIMessage("+15551234567", "Hello from my agent!")
print(result)
}Effects
std::sendIMessage
ts
@always(to)
effect std::sendIMessage {
to: string
}(source)
Functions
sendIMessage
ts
sendIMessage(
to: string,
message: string,
allowList: string[] = [],
blockList: string[] = [],
): Result raises <std::sendIMessage>Send an iMessage through the macOS Messages app.
Only works on macOS with Messages.app signed in to iMessage. No API key required.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
| to | string | The recipient's phone number or iMessage email address. | |
| message | string | Non-empty message text. | |
| allowList | string[] | [] | Limit recipients to these addresses or numbers, or leave empty for no allow restriction. |
| blockList | string[] | [] | Reject these addresses or numbers even if they are allowed. |
Returns: Result
Throws: std::sendIMessage
Needs: subprocess
(source)