diff --git a/VERSION b/VERSION index ca222b7cf3..610e28725b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.23.0 +0.23.1 diff --git a/backend/sources/facebook/events-router/src/main/java/co/airy/core/sources/facebook/MessageParser.java b/backend/sources/facebook/events-router/src/main/java/co/airy/core/sources/facebook/MessageParser.java index fcc8bd354f..b2a4bc6823 100644 --- a/backend/sources/facebook/events-router/src/main/java/co/airy/core/sources/facebook/MessageParser.java +++ b/backend/sources/facebook/events-router/src/main/java/co/airy/core/sources/facebook/MessageParser.java @@ -47,10 +47,17 @@ public Message.Builder parse(final String payload) throws Exception { final Map headers = new HashMap<>(); - if(appId != null && !this.facebookAppId.equals(appId)) { + if (!isEcho) { + senderId = getSourceConversationId(webhookMessaging); + } else if (appId != null && !appId.equals(this.facebookAppId)) { + // Third party app senderId = appId; - } else { + } else if (appId == null) { + // Sent by Facebook moderator via Facebook inbox senderId = getSourceConversationId(webhookMessaging); + } else { + // Filter out echoes coming from this app + throw new NotAMessageException(); } if (postbackNode != null) { @@ -70,7 +77,6 @@ public Message.Builder parse(final String payload) throws Exception { .setSenderId(senderId) .setIsFromContact(!isEcho) .setHeaders(headers) - .setSenderId(senderId) .setSentAt(webhookMessaging.get("timestamp").asLong()); } }