# SERVER EXPORTS

<details>

<summary>Return Object Structure</summary>

```
{
  "success": true,
  "message": {
    "id": 123,
    "sender": "System",
    "content": "Your vehicle is ready.",
    "type": "text",
    "createdAt": 1678900000
  },
  "conversation": {
    "name": "Mechanic",
    "avatar": "default",
    "conversationId": 45,
    "participants": ["555-0101", "System"],
    "isGroup": false,
    "createdAt": 1678900000
  }
}
```

</details>

### Send Message (By Source)

Sends a text message to a player using their Server ID (Source). If a conversation does not exist, it will be created automatically.

{% code overflow="wrap" lineNumbers="true" %}

```lua
local response = exports["17mov_Phone"]:Messages_SendMessageToSrc(src, message, sender)
```

{% endcode %}

**Returns:**

* `table`: `{ success: boolean, message?: MessageData, conversation?: ConversationData }`

<table><thead><tr><th width="112" align="center">Argument</th><th width="159" align="center">Type</th><th width="110" align="center">Optional</th><th>Explanation</th></tr></thead><tbody><tr><td align="center">src</td><td align="center"><code>number</code></td><td align="center">❌</td><td>The player's server ID (source).</td></tr><tr><td align="center">message</td><td align="center"><code>string</code></td><td align="center">❌</td><td>Message content.</td></tr><tr><td align="center">sender</td><td align="center"><code>number | string</code></td><td align="center">✅</td><td>Sender number or name, default is "System"</td></tr></tbody></table>

### Send Message (By Number)

Sends a text message to a player using their phone number.

{% code overflow="wrap" lineNumbers="true" %}

```lua
local response = exports["17mov_Phone"]:Messages_SendMessageToNumber(number, message, sender)
```

{% endcode %}

**Returns:**

* `table`: `{ success: boolean, message?: MessageData, conversation?: ConversationData }`

<table><thead><tr><th width="122" align="center">Argument</th><th width="163" align="center">Type</th><th width="112" align="center">Optional</th><th>Explanation</th></tr></thead><tbody><tr><td align="center">number</td><td align="center"><code>number</code></td><td align="center">❌</td><td>Target player number</td></tr><tr><td align="center">message</td><td align="center"><code>string</code></td><td align="center">❌</td><td>Message content.</td></tr><tr><td align="center">sender</td><td align="center"><code>number | string</code></td><td align="center">✅</td><td>Sender number or name, default is "System"</td></tr></tbody></table>

### Delete Message

Permanently deletes a specific message from the database and updates all clients involved.

{% code overflow="wrap" lineNumbers="true" %}

```lua
local success = exports["17mov_Phone"]:Messages_DeleteMessageById(messageId)
```

{% endcode %}

**Returns:**

* `boolean`: `true` if message was successfully deleted.

<table><thead><tr><th width="118" align="center">Argument</th><th width="95" align="center">Type</th><th width="111" align="center">Optional</th><th>Explanation</th></tr></thead><tbody><tr><td align="center">messageId</td><td align="center"><code>number</code></td><td align="center">❌</td><td>Target message ID.</td></tr></tbody></table>

### How to send location

{% code lineNumbers="true" %}

```lua
exports['17mov_Phone']:Messages_SendMessageToSrc(src, {
    sender = "6872731",
    content = json.encode(vector2(1000.0, 1000.0)),
    type = 'location'
})
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.17movement.net/phone/exports/messages/server-exports.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
