Skip to content

GOWA - WhatsApp REST API with support for UI, Multi Account, Webhooks, and MCP, and Chatwoot. Built with Golang for efficient memory use.

feat: add PTT support for audio messages

Aldino Kemalfb2a9fa560d1
diff --git a/src/config/settings.go b/src/config/settings.go
index 0448a13d..26e67d61 100644
--- a/src/config/settings.go
+++ b/src/config/settings.go
@@ -30,17 +30,17 @@ var (
WhatsappAutoMarkRead = false // Auto-mark incoming messages as read
WhatsappAutoDownloadMedia = true // Auto-download media from incoming messages
WhatsappWebhook []string
- WhatsappWebhookSecret = "secret"
- WhatsappWebhookInsecureSkipVerify = false // Skip TLS certificate verification for webhooks (insecure)
- WhatsappWebhookEvents []string // Whitelist of events to forward to webhook (empty = all events)
- WhatsappLogLevel = "ERROR"
- WhatsappSettingMaxImageSize int64 = 20000000 // 20MB
- WhatsappSettingMaxFileSize int64 = 50000000 // 50MB
- WhatsappSettingMaxVideoSize int64 = 100000000 // 100MB
- WhatsappSettingMaxDownloadSize int64 = 500000000 // 500MB
- WhatsappTypeUser = "@s.whatsapp.net"
- WhatsappTypeGroup = "@g.us"
- WhatsappAccountValidation = true
+ WhatsappWebhookSecret = "secret"
+ WhatsappWebhookInsecureSkipVerify = false // Skip TLS certificate verification for webhooks (insecure)
+ WhatsappWebhookEvents []string // Whitelist of events to forward to webhook (empty = all events)
+ WhatsappLogLevel = "ERROR"
+ WhatsappSettingMaxImageSize int64 = 20000000 // 20MB
+ WhatsappSettingMaxFileSize int64 = 50000000 // 50MB
+ WhatsappSettingMaxVideoSize int64 = 100000000 // 100MB
+ WhatsappSettingMaxDownloadSize int64 = 500000000 // 500MB
+ WhatsappTypeUser = "@s.whatsapp.net"
+ WhatsappTypeGroup = "@g.us"
+ WhatsappAccountValidation = true
ChatStorageURI = "file:storages/chatstorage.db"
ChatStorageEnableForeignKeys = true
diff --git a/src/domains/send/audio.go b/src/domains/send/audio.go
index 7ab560b2..7f1e5926 100644
--- a/src/domains/send/audio.go
+++ b/src/domains/send/audio.go
@@ -6,4 +6,5 @@ type AudioRequest struct {
BaseRequest
Audio *multipart.FileHeader `json:"audio" form:"audio"`
AudioURL *string `json:"audio_url" form:"audio_url"`
+ PTT bool `json:"ptt" form:"ptt"`
}
diff --git a/src/usecase/send.go b/src/usecase/send.go
index d7009bf9..7f4e2058 100644
--- a/src/usecase/send.go
+++ b/src/usecase/send.go
@@ -837,6 +837,7 @@ func (service serviceSend) SendAudio(ctx context.Context, request domainSend.Aud
FileSHA256: audioUploaded.FileSHA256,
FileEncSHA256: audioUploaded.FileEncSHA256,
MediaKey: audioUploaded.MediaKey,
+ PTT: proto.Bool(request.PTT),
},
}
diff --git a/src/views/components/SendAudio.js b/src/views/components/SendAudio.js
index 71f9ec9d..f1267116 100644
--- a/src/views/components/SendAudio.js
+++ b/src/views/components/SendAudio.js
@@ -14,6 +14,7 @@ export default {
is_forwarded: false,
audio_url: null,
duration: 0,
+ ptt: false,
}
},
computed: {
@@ -59,6 +60,7 @@ export default {
let payload = new FormData();
payload.append("phone", this.phone_id)
payload.append("is_forwarded", this.is_forwarded)
+ payload.append("ptt", this.ptt)
if (this.duration && this.duration > 0) {
payload.append("duration", this.duration)
}
@@ -89,6 +91,7 @@ export default {
this.type = window.TYPEUSER;
this.is_forwarded = false;
this.duration = 0;
+ this.ptt = false;
$("#file_audio").val('');
this.selectedFileName = null;
this.audio_url = null;
@@ -127,6 +130,13 @@ export default {
<label>Mark audio as forwarded</label>
</div>
</div>
+ <div class="field">
+ <label>Voice Note (PTT)</label>
+ <div class="ui toggle checkbox">
+ <input type="checkbox" aria-label="ptt" v-model="ptt">
+ <label>Send as voice note (required for OGG/Opus files)</label>
+ </div>
+ </div>
<div class="field">
<label>Disappearing Duration (seconds)</label>
<input v-model.number="duration" type="number" min="0" placeholder="0 (no expiry)" aria-label="duration"/>