6.6 KiB
6.6 KiB
Webhooks & Upload Service Configuration
This page explains all configuration options for Discord webhooks and media upload services in codem-phone.
Discord Webhooks
Discord webhooks are used to log various activities to your Discord server channels.
Webhooks = {
selly = 'https://discord.com/api/webhooks/YOUR_WEBHOOK_ID/YOUR_WEBHOOK_TOKEN',
chater = 'https://discord.com/api/webhooks/YOUR_WEBHOOK_ID/YOUR_WEBHOOK_TOKEN',
media = 'https://discord.com/api/webhooks/YOUR_WEBHOOK_ID/YOUR_WEBHOOK_TOKEN'
}
| Webhook | Description |
|---|---|
selly |
Logs marketplace listings and transactions from Selly app |
chater |
Logs chat messages and conversations |
media |
Logs uploaded media (photos, videos, audio) |
How to Create a Discord Webhook
- Go to your Discord server
- Navigate to Server Settings → Integrations → Webhooks
- Click New Webhook
- Name your webhook and select the channel
- Click Copy Webhook URL
- Paste the URL in the config
Upload Service
The upload service handles all media uploads (images, videos, audio) from the phone.
Active Provider
UploadService = {
activeProvider = 'FivemanageNew',
presignedEndpoint = 'https://fmapi.net/api/v2/presigned-url',
apiKeys = {
audio = 'YOUR_AUDIO_API_KEY',
video = 'YOUR_VIDEO_API_KEY',
image = 'YOUR_IMAGE_API_KEY'
}
}
| Parameter | Type | Description |
|---|---|---|
activeProvider |
string | Selected upload provider |
presignedEndpoint |
string | Fivemanage presigned URL endpoint |
apiKeys |
table | API keys for each media type |
Available Providers
| Provider | Description |
|---|---|
FivemanageNew |
Fivemanage v2 with presigned URLs (Recommended) |
FivemanageLegacy |
Fivemanage legacy API |
CustomProvider |
Your own custom upload endpoint |
Media Upload Providers
Fivemanage New (Recommended)
The newest and most efficient method using presigned URLs.
FivemanageNew = {
All = {
endpoint = "PRESIGNED_URL",
formField = "file",
successResponse = {
key = "data.url"
},
includeMetadata = "metadata"
},
}
Setup:
- Go to fivemanage.com
- Create an account and get your API keys
- Add your API keys to
UploadService.apiKeys
Fivemanage Legacy
The older Fivemanage API method with direct uploads.
FivemanageLegacy = {
VideoUpload = {
endpoint = "https://fmapi.net/api/v2/video",
formField = "file",
requestHeaders = {
["Authorization"] = "API_KEY"
},
successResponse = {
key = "data.url"
},
},
ImageUpload = {
endpoint = "https://fmapi.net/api/v2/image",
formField = "file",
requestHeaders = {
["Authorization"] = "API_KEY"
},
successResponse = {
key = "data.url"
}
},
AudioUpload = {
endpoint = "https://fmapi.net/api/v2/audio",
formField = "file",
requestHeaders = {
["Authorization"] = "API_KEY"
},
successResponse = {
key = "data.url"
}
},
}
| Media Type | Endpoint |
|---|---|
| Video | https://fmapi.net/api/v2/video |
| Image | https://fmapi.net/api/v2/image |
| Audio | https://fmapi.net/api/v2/audio |
Custom Provider
Configure your own upload service with full customization.
CustomProvider = {
VideoUpload = {
endpoint = "https://your-api-endpoint.com/media/upload?key=API_KEY",
formField = "media",
requestHeaders = {
["Authorization"] = "Bearer API_KEY",
["Content-Type"] = "multipart/form-data"
},
errorResponse = {
key = "error",
errorValue = true
},
successResponse = {
key = "data.mediaUrl"
},
fileExtension = "webm",
},
ImageUpload = {
endpoint = "https://your-api-endpoint.com/media/upload?key=API_KEY",
formField = "media",
requestHeaders = {
["Authorization"] = "Bearer API_KEY",
["Content-Type"] = "multipart/form-data"
},
errorResponse = {
key = "error",
errorValue = true
},
successResponse = {
key = "data.mediaUrl"
},
fileExtension = "png",
},
AudioUpload = {
endpoint = "https://your-api-endpoint.com/media/upload?key=API_KEY",
formField = "media",
requestHeaders = {
["Authorization"] = "Bearer API_KEY",
["Content-Type"] = "multipart/form-data"
},
errorResponse = {
key = "error",
errorValue = true
},
successResponse = {
key = "data.mediaUrl"
},
fileExtension = "mp3",
},
}
Custom Provider Parameters
| Parameter | Type | Description |
|---|---|---|
endpoint |
string | Your API upload endpoint URL |
formField |
string | Form field name for the file |
requestHeaders |
table | HTTP headers to send with request |
errorResponse.key |
string | JSON path to error indicator |
errorResponse.errorValue |
any | Value that indicates an error |
successResponse.key |
string | JSON path to the returned media URL |
fileExtension |
string | File extension for uploads |
File Extensions by Media Type
| Media Type | Default Extension |
|---|---|
| Video | webm |
| Image | png |
| Audio | mp3 |
Switching Providers
To switch between providers, change the activeProvider value:
-- Use Fivemanage New (Recommended)
activeProvider = 'FivemanageNew'
-- Use Fivemanage Legacy
activeProvider = 'FivemanageLegacy'
-- Use Custom Provider
activeProvider = 'CustomProvider'
Getting Fivemanage API Keys
- Visit fivemanage.com
- Create an account or log in
- Navigate to Dashboard → API Keys
- Generate separate keys for:
- Image uploads
- Video uploads
- Audio uploads
- Copy each key to the corresponding field in
UploadService.apiKeys
Note: Keep your API keys private. Never share them publicly or commit them to public repositories.