From 53b9f64bbe1493eecb6f60a5f8ed6e933b10dc55 Mon Sep 17 00:00:00 2001 From: zlshames Date: Sun, 9 Oct 2022 12:53:58 -0400 Subject: [PATCH] scheduled messages will send using private api, if enabled --- .../src/server/services/scheduledMessagesService/index.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/server/src/server/services/scheduledMessagesService/index.ts b/packages/server/src/server/services/scheduledMessagesService/index.ts index 03da317f..ccaf4440 100644 --- a/packages/server/src/server/services/scheduledMessagesService/index.ts +++ b/packages/server/src/server/services/scheduledMessagesService/index.ts @@ -334,6 +334,14 @@ export class ScheduledMessagesService { scheduledMessage.status = ScheduledMessageStatus.IN_PROGRESS; this.saveScheduledMessage(scheduledMessage); + // Inject the method based on if it's not already provided, + // or if the private api is enabled on the server & connected. + if (!scheduledMessage.payload.method) { + const papiEnabled = Server().repo.getConfig("enable_private_api") as boolean; + scheduledMessage.payload.method = + papiEnabled && !!Server().privateApiHelper.helper ? "private-api" : "apple-script"; + } + // Send the message try { if (scheduledMessage.type === ScheduledMessageType.SEND_MESSAGE) {