# Webhooks

Logging every pawn shop transaction to a Discord channel.

{% stepper %}
{% step %}
**Open your Discord server**

Go to the channel you want logs in.
{% endstep %}

{% step %}
**Create a webhook**

Channel Settings → Integrations → Webhooks → New Webhook. Give it a name and click Copy Webhook URL.
{% endstep %}

{% step %}
**Paste into config.lua**

```lua
Config.Webhook = 'https://discord.com/api/webhooks/XXXXXXXXX/XXXXXXXXXXXXXXXX'
```

{% endstep %}
{% endstepper %}

## Embed Fields

Each successful sale posts a green embed with the following information:

| Field           | Example value               |
| --------------- | --------------------------- |
| Player name     | John\_Doe                   |
| Item label      | Gold Chain                  |
| Quantity        | 3                           |
| Price per unit  | $500                        |
| Total received  | $1500                       |
| Money type      | Cash or Bank                |
| Server ID       | 12                          |
| Discord mention | @user (if identifier found) |
| License         | license:abc123...           |
| Timestamp       | 2025-06-01 14:32:00         |

## Customization

To change the embed appearance, edit `sendWebhook()` in `server/server.lua`:

```lua
embeds = {{ title = '🏪 Pawn Shop Sale', description = message, color = 3066993, -- decimal color (green)
footer = {{ text = os.date('%Y-%m-%d %H:%M:%S') }} }}
```

Convert hex to decimal for the color: `#2ECC71` = `3066993`. Use any online hex-to-decimal converter.

🔒

**Keep your webhook URL private**Anyone with the URL can post to your Discord channel. If it leaks, delete the webhook in Discord immediately and generate a new one.


---

# 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://mohssins.gitbook.io/mohscriptsdocs/moh-pawnshop/webhooks.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.
