Using API.ai for NLP to redirect to the right flow

(Vila Vg) #1

Hi there

In response to a user’s typed query, is it possible to use NLP functionality from API.ai to understand synonyms and then direct the user to the right keyword response / flow?

So if a user says “cash”, instead of defining every synonymous keyword to “cash”, is there a way to understand the synonym and trigger the a flow / keyword for “money”, which I will have defined.

thanks!

2 Likes
(Daniel Beckett) #2

Hi Vila,

You may have more luck reaching out to the Api.ai support team / their community for this question. In regards to Flow XO functionality that could be used for this you could look into the word and phrase grouping on Bot Triggers & Actions.

If you know what key words you are expecting then you could setup the groups for them. E.g.

cash [money]
currency [money]

etc.

1 Like
(Talvinder) #3

I implemented API.ai for one of my bots. I did the following:

  1. Created intents, entities and action in API.ai
  2. Implemented a catch-all flow
  3. Implemented an action to parse natural language query via api.ai using http request
  4. Used the action keyword from the response of step 3 as trigger for relevant flow. Important to name the actions uniquely

That’s it!

3 Likes
#4

This all makes sense, but #3… What’s flute?

(Talvinder) #5

Lol! My bad actually!

Flute is the name of bot that I made. Edited the original post.

#6

This is interesting, I was considering doing something similar with Amazon Lex (their version of api.ai). So basically FlowXO is the bot engine, but you get to leverage the NLP features from these “ai” providers.

I’d be interested how this works out for you going forward… I was thinking of putting Lex “in front” of FlowXO, but your way seems like a much better way to use the best parts of both platforms.

(John Jackson) #7

Yes we have a great HTTP/webhook service so you can make virtually any API call to send an ‘utterance’ to a NLP service and get back the intent/entities, etc…

(Khashayar) #8

Do you end up with dozens of flows after this?! All my Api.ai agents have so many entities and intents.

1 Like
(John Jackson) #9

No, a single API.AI project will only have one endpoint to query for all the possible intents it understands.

(Talvinder) #10

Nope. I used api.ai in a http/webhook action in the catch-all flow once and then routed the result to the relevant flow. The number of supporting flows that you need depends on the granularity that you want to go to. I built a bot similar in service to thumbtack and was able to do everything in 4 flows.

(Khashayar) #11

Okay, so you’d detect the job type using API.AI and then each job type
would have its own flow?

Does every API.AI action have to end in a new webhook triggered flow?

(Talvinder) #12

No. I wanted to conserve my flows (free plan :smiley: ). So, I routed all job
types to a single flow, which then had multiple actions filtered against
keywords. So for example, keyword “KW.food” will filter few actions while
keyword “KW.house” will filter some other actions.

(Khashayar) #13

Ah yes! Of course! This all makes a lot more sense now! Specially now that the team is going to work on flow speeds, there’ll be a lot of opportunities to integrate NLP.

(Vila Vg) #14

@chatfuel mods @johnjackson

Request: This would a great thread to do a tutorial on. It’s quite important to a lot of people

2 Likes
(Talvinder) #15

happy to do one @johnjackson

In my bot, I was able to incorporate recursive follow up question functionality of api.ai as well.

2 Likes
(John Jackson) #16

That would be brilliant! In fact, if you could share your flows with us, we can get a tutorial written up and give you a mention and thanks in the article. :smiley:

If you can help with this, please either share your flows here (careful with auth tokens of course), or email us directly. Thank you for your help, much appreciated!

3 Likes
(Anish Duggal) #17

Any chance of a step by step tutorial for those of us not so well versed?

Thanks

#18

I’ve had good success using a “catch all” trigger to route request to api.ai, then use the great FlowXO bot framework to be my main “user interface.”

I’m actually using built.io as a sort of middleware so that it can manage a series of complex logic based on the intents and responses I get from api.ai so it goes something like this…

Slack --> FlowXO -> Built.io --> Api.ai --> Built.io --> FlowXO --> Slack

(yes, seems like a lot of layers, but it’s working great).

One challenge I am having is routing requests externally for “mentions” of the bot. For example:

@mybot thanks” goes to the catch-all and I get my friendly NPL replies.

However, “thanks @mybot” is considered a “mention” and thus does not get routed to the catch-all.

Is there a way to create a FlowXO trigger that would activate on a “mention” with any text?

As in: “[any text here] @mybot” ?

(Khashayar) #19

But why use Built.io when Flowxo has tons of integrations and the webhook action?
I feel like your responses would get really slow like this. No?

(Talvinder) #20

Sure @johnjackson Should I share the flows with support@flowxo?

3 Likes