> For the complete documentation index, see [llms.txt](https://cylexdev.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cylexdev.gitbook.io/docs/cylex-phone/exports-and-events/server-exports/messages.md).

# Messages

#### **sendMessage** <a href="#user-content-sendmessage" id="user-content-sendmessage"></a>

Send a custom SMS message manually from one number to another.

```lua
-- senderNumber: string - The phone number sending the message. Can be a system number (e.g. "SYSTEM").
-- targetNumber: string - The phone number of the receiver.
-- messageContent: string - The text content of the message.
-- return: boolean

-- Programmatically sends an SMS to a specific phone number.
-- If the conversation does not exist, it will be automatically created.
-- Both players (if online) will receive UI updates and notification sounds.
-- Returns true if successful, false if missing arguments.

local success = exports['cylex_phone']:sendMessage("555-1234", "555-9876", "Hello from external script!")

if success then
    print("Message sent successfully!")
else
    print("Failed to send the message. Check your arguments.")
end
```

#### **sendLocation**  <a href="#user-content-sendlocation-not-sendcoords-yerine-sendlocation-olarak-gecer" id="user-content-sendlocation-not-sendcoords-yerine-sendlocation-olarak-gecer"></a>

Send an interactive location map ping via messages app.

```lua
-- senderNumber: string - The phone number sending the location.
-- targetNumber: string - The phone number of the receiver.
-- coords: table - The coordinates to send (table with x,y,z or vector3 format).
-- return: boolean

-- Similar to a standard text message, but sends an interactive GPS location.
-- The receiver can click the message in their Messages app to set a waypoint on their pause map.
-- Target will receive a notification and a map preview in the chat.
-- Returns true if successful, false if missing arguments.

local playerCoords = GetEntityCoords(GetPlayerPed(source))
local success = exports['cylex_phone']:sendLocation("5551234", "5559876", { x = playerCoords.x, y = playerCoords.y })

if success then
    print("Location sent successfully!")
else
    print("Failed to send location.")
end
```
