Skip to content

Commit

Permalink
fix(automation): facebook message won't send
Browse files Browse the repository at this point in the history
  • Loading branch information
Wlkr123 committed May 8, 2024
1 parent 21b4678 commit 7e4399c
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/plugin-facebook-api/src/automations/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const generateMessages = async (
subdomain: string,
config: any,
conversation: IConversation,
customer: ICustomer
customer: ICustomer,
) => {
let { messages = [] } = config || {};

Expand Down Expand Up @@ -258,9 +258,9 @@ const generateObjectToWait = ({
obj.waitingActionId = actionIdIfNotReply;

propertyName = 'botId';
}else{
obj.startWaitingDate = moment().add(24,'hours').toDate()
obj.waitingActionId = null
} else {
obj.startWaitingDate = moment().add(24, 'hours').toDate();
obj.waitingActionId = null;
}

return {
Expand Down Expand Up @@ -339,7 +339,9 @@ export const actionCreateMessage = async (
},
recipientId,
integration.erxesApiId,
);
).catch((error) => {
throw new Error(error);
});

if (!resp) {
return;
Expand All @@ -362,7 +364,8 @@ export const actionCreateMessage = async (
...conversationMessage.toObject(),
conversationId: conversation.erxesApiId,
},
isRPC:true
}).catch((error) => {
debugError(error.message);
});

result.push(conversationMessage);
Expand All @@ -384,5 +387,6 @@ export const actionCreateMessage = async (
};
} catch (error) {
debugError(error.message);
throw new Error(error.message);
}
};

0 comments on commit 7e4399c

Please sign in to comment.