Last active
February 25, 2017 17:52
-
-
Save stripethree/6cf56f921dd9350e2aefe0410f2b54d7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
routeEachMessage(messagingEvent) { | |
const cacheKey = messagingEvent.sender.id; | |
return cache.get(cacheKey) | |
.then((session = {_key: cacheKey, count: 0}) => { | |
// check if profile info is already in the session, | |
// if not, fetch it from Graph API | |
}) | |
.then((session) => { | |
session.count++; | |
if (messagingEvent.message) { | |
this.onMessage(messagingEvent, session); | |
} else { | |
… | |
} | |
}) | |
.then((session) => this.saveSession(session)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Used in this Chatbots Magazine article.