@peopl-health/nexus 4.2.5 → 4.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -75,7 +75,6 @@ const sendMessageController = async (req, res) => {
|
|
|
75
75
|
timeZone: timeZone || null,
|
|
76
76
|
sendTime: sendTime ? moment.tz(sendTime, timeZone) + 2500 : new Date(),
|
|
77
77
|
code: ensureWhatsAppFormat(code),
|
|
78
|
-
extraDelay: 0,
|
|
79
78
|
frontendId,
|
|
80
79
|
triggeredBy
|
|
81
80
|
};
|
|
@@ -118,9 +117,9 @@ const sendBulkMessageController = async (req, res) => {
|
|
|
118
117
|
timeZone: timeZone || null,
|
|
119
118
|
sendTime: new Date(sendMoment + extraDelay),
|
|
120
119
|
code: ensureWhatsAppFormat(recipient),
|
|
121
|
-
extraDelay: extraDelay += Math.floor(Math.random() * 5001) + 5000,
|
|
122
120
|
triggeredBy
|
|
123
121
|
});
|
|
122
|
+
extraDelay += Math.floor(Math.random() * 5001) + 5000;
|
|
124
123
|
}
|
|
125
124
|
|
|
126
125
|
await _sendBulkMessages(payloads, res, `Sent bulk of ${codes.length} messages`);
|
|
@@ -37,11 +37,6 @@ async function recordDeliveryAttempt({
|
|
|
37
37
|
completedAt: new Date()
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
-
await Message.updateOne(
|
|
41
|
-
{ _id: targetId },
|
|
42
|
-
{ $set: { 'statusInfo.latestDeliveryStatus': status } }
|
|
43
|
-
);
|
|
44
|
-
|
|
45
40
|
return attempt;
|
|
46
41
|
} catch (error) {
|
|
47
42
|
logger.error('[deliveryAttemptHelper] Failed to record delivery attempt', {
|
|
@@ -15,7 +15,6 @@ async function updateMessageStatus(messageSid, status, errorCode = null, errorMe
|
|
|
15
15
|
try {
|
|
16
16
|
const updateData = {
|
|
17
17
|
'statusInfo.status': status,
|
|
18
|
-
'statusInfo.latestDeliveryStatus': status,
|
|
19
18
|
'statusInfo.updatedAt': new Date(),
|
|
20
19
|
...(errorCode && { 'statusInfo.errorCode': errorCode }),
|
|
21
20
|
...(errorMessage && { 'statusInfo.errorMessage': errorMessage })
|
|
@@ -10,12 +10,10 @@ const scheduledMessageSchema = new mongoose.Schema({
|
|
|
10
10
|
contentType: { type: String, default: null },
|
|
11
11
|
code: String,
|
|
12
12
|
variables: Object,
|
|
13
|
-
extraDelay: Number,
|
|
14
13
|
timeZone: { type: String, default: 'Etc/GMT' },
|
|
15
14
|
status: { type: String, default: 'pending' },
|
|
16
15
|
wa_id: { type: String, default: null },
|
|
17
16
|
frontendId: { type: String, default: null },
|
|
18
|
-
flowActionPayload: { type: mongoose.Schema.Types.Mixed, default: null },
|
|
19
17
|
triggeredBy: { type: String, default: null },
|
|
20
18
|
parentMessageId: { type: mongoose.Schema.Types.ObjectId, ref: 'Message', default: null },
|
|
21
19
|
createdAt: { type: Date, default: Date.now }
|
|
@@ -85,12 +85,7 @@ const messageSchema = new mongoose.Schema({
|
|
|
85
85
|
recoveryTemplateSid: { type: String, default: null },
|
|
86
86
|
recoveryStartedAt: { type: Date, default: null },
|
|
87
87
|
recoverySentAt: { type: Date, default: null },
|
|
88
|
-
recoveryRejectedAt: { type: Date, default: null }
|
|
89
|
-
latestDeliveryStatus: {
|
|
90
|
-
type: String,
|
|
91
|
-
enum: DELIVERY_ATTEMPT_STATUSES,
|
|
92
|
-
default: null
|
|
93
|
-
}
|
|
88
|
+
recoveryRejectedAt: { type: Date, default: null }
|
|
94
89
|
},
|
|
95
90
|
prompt: { type: Object, default: null },
|
|
96
91
|
preset: { type: Object, default: null },
|