Skip to content

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:

NameTypeDefaultDescription
tostringThe recipient's phone number or iMessage email address.
messagestringNon-empty message text.
allowListstring[][]Limit recipients to these addresses or numbers, or leave empty for no allow restriction.
blockListstring[][]Reject these addresses or numbers even if they are allowed.

Returns: Result

Throws: std::sendIMessage

Needs: subprocess

(source)