• KJ Ha

(Just)FriendBot --version 2

Continuing from the previous assignment, I've worked on (Just)FriendBot with enabled fulfillment for some intents.


Example: fulfillment using sentiment library


app.intent("feel-empathy", (conv) => {
 let mood = conv.query;
 let moodSentiment = sentiment.analyze(mood);
 let day = "";

 if (moodSentiment.score > 2) {
        day = `Wonderful to hear that!`;
    } else if (moodSentiment >= 0 && moodSentiment < 2) {
        day = `I whish I could make you day a little better.`;
    } else {
        day = `I'm so sorry to hear that. Is there anything I can do for you?`;
    }
    conv.ask(day)
});
    

Depending on the sentiment score of the user's response, the bot will repond accordingly for better interactivity.



(Just)FriendBot --version 1: documentation


Code


Demo Video