Skip to content

Commit

Permalink
[#1921] Filter out Facebook echoes sent by airy (#1923)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismatix authored Jun 4, 2021
1 parent 01f1872 commit 6fb707c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.23.0
0.23.1
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,17 @@ public Message.Builder parse(final String payload) throws Exception {

final Map<String, String> 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) {
Expand All @@ -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());
}
}

0 comments on commit 6fb707c

Please sign in to comment.