Sequoia: Messages send file

Trying to send a file through Messages on Sequoia 15.1

Overview:
So I have this code to send an attached txt file to the number here. It seems to work sending the file through the messages app but there is a progress bar that eventually times out and there is a message “Not Delivered” in red.

Question:

  • What am I doing wrong?

Error:
Not Delivered

Issue:

  • file is in the messages interface but progress bar appears, eventually timing out showing “Not Delivered”

Permissions given: Script Editor

  • Privacy & Security > Full Disk Access
  • Privacy & Security > Accessibility

Code

-- Define the recipient's phone number or email
set recipientHandle to "+1234567890" -- phone number

-- Define the file path for the attachment
set filePath to POSIX file "/Users/User1/Documents/test.txt" -- file path

tell application "Messages"
	-- Get the iMessage service
	set iMessageService to first account whose service type = iMessage
	
	-- Send the message with the attachment directly to the recipient
	send file filePath to participant recipientHandle of iMessageService
end tell

Connectivity issue? Instantaneous transfer here. Also Sequoia 15.1.

EDIT:
Correction. This transfer completed LOCALLY. It populated the file and the file is openable in Messages, but it did not, in fact, transfer.

Don’t believe so if I manually take that same file and send it. It sends with no problem. using the script It attempts to send it the progress bar shows but it looks like it timesout where it says "Not Delivered"

In fact the file is 2KB so it shouldn’t even need a progress bar.

Robert Fern posted a solution previously, messages - send file - #2 by robertfern addressing the chat rather than the participant but, while it does attach and send without any error or “Not Delivered” warning, I do not receive the attachment.

Still getting the same results. Plus a mystery result.

  • it attempts to send it to the number then instantly fails and gets "Not Delivered"
  • it also attempts to send it to “1234567890” which is no where to be found in the script at all.

Bizzare solution to this one. Put the file in your Pictures folder and then send it. Success.

odd for sure, I can also confirm the pictures folder allows the file to be sent… no other folder seems to work.