Add samePhoneResponsePrefix config option
Automatically prefixes responses with a configurable string when in
same-phone mode. This helps distinguish bot replies from user messages
in the same chat bubble.
Example config:
"samePhoneResponsePrefix": "🦞"
Will prefix all same-phone replies with the lobster emoji.
main
parent
d88ede92b9
commit
25ec133574
|
|
@ -47,6 +47,7 @@ export type WarelayConfig = {
|
||||||
inbound?: {
|
inbound?: {
|
||||||
allowFrom?: string[]; // E.164 numbers allowed to trigger auto-reply (without whatsapp:)
|
allowFrom?: string[]; // E.164 numbers allowed to trigger auto-reply (without whatsapp:)
|
||||||
samePhoneMarker?: string; // Prefix for same-phone mode messages (default: "[same-phone]")
|
samePhoneMarker?: string; // Prefix for same-phone mode messages (default: "[same-phone]")
|
||||||
|
samePhoneResponsePrefix?: string; // Prefix auto-added to replies in same-phone mode (e.g., "🦞")
|
||||||
transcribeAudio?: {
|
transcribeAudio?: {
|
||||||
// Optional CLI to turn inbound audio into text; templated args, must output transcript to stdout.
|
// Optional CLI to turn inbound audio into text; templated args, must output transcript to stdout.
|
||||||
command: string[];
|
command: string[];
|
||||||
|
|
@ -141,6 +142,7 @@ const WarelaySchema = z.object({
|
||||||
.object({
|
.object({
|
||||||
allowFrom: z.array(z.string()).optional(),
|
allowFrom: z.array(z.string()).optional(),
|
||||||
samePhoneMarker: z.string().optional(),
|
samePhoneMarker: z.string().optional(),
|
||||||
|
samePhoneResponsePrefix: z.string().optional(),
|
||||||
transcribeAudio: z
|
transcribeAudio: z
|
||||||
.object({
|
.object({
|
||||||
command: z.array(z.string()),
|
command: z.array(z.string()),
|
||||||
|
|
|
||||||
|
|
@ -594,6 +594,15 @@ export async function monitorWebProvider(
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Apply same-phone response prefix if configured and in same-phone mode
|
||||||
|
const samePhoneResponsePrefix = cfg.inbound?.samePhoneResponsePrefix;
|
||||||
|
if (isSamePhoneMode && samePhoneResponsePrefix && replyResult.text) {
|
||||||
|
// Only add prefix if not already present
|
||||||
|
if (!replyResult.text.startsWith(samePhoneResponsePrefix)) {
|
||||||
|
replyResult.text = `${samePhoneResponsePrefix} ${replyResult.text}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await deliverWebReply({
|
await deliverWebReply({
|
||||||
replyResult,
|
replyResult,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue