0

Does anyone know if it's possible to return a different message etc to the chat user if it's the very first time they are interacting with the bot?

For instance, if a user says "hello" (or anything) for the very first time, the bot might respond with, "Hello there!"

If a user says hello some time later, the bot might respond with "Hello, again!"

Looking through the developer docs I'm struggling to find an answer: https://developers.facebook.com/docs/messenger-platform

For context, I'm also using the https://api.ai service.

danielmeade
  • 164
  • 1
  • 12

2 Answers2

2

One way to accomplish this is to set up a "get started" button:

https://developers.facebook.com/docs/messenger-platform/messenger-profile/get-started-button

This might also be helpful:

https://developers.facebook.com/docs/messenger-platform/messenger-profile/greeting-text

(But I haven't used it myself, so I'm not sure what it does.)

Also, as already mentioned, you can store user data in your own database, and send a greeting message if you can't find the user there already.

an491445
  • 161
  • 4
1

This would currently not be possible with API.ai out of the box, you'd have to build a custom webhook that would save the user id to database and check it on new session.

As a (very) hacky workaround you could try outputting a context after the first hello and each and every other intent you use inputs and outputs that context, essentially remembering the user has talked to the bot via a 'permanent' context.

AiDev
  • 1,214
  • 8
  • 11