Search code examples
node.jsdialogflow-esdialogflow-es-fulfillmentkommunicate

How to encounter reply when user attaches a document/image to a chatbot(Build with dialogflow and kommunicate)?


I have tried many different methods but it is not working properly.Please any one can help me how to send a reply when user uploads any attachments in a chatbot.


Solution

  • To be able to achieve your objective, it is important to understand what dialogflow events are: Events allow you to invoke intents based on something that has happened instead of what a user communicates. Dialogflow supports events from several platforms (like Google Assistant, Slack, and more) based on actions users take on those platforms.

    When a user attaches a file or shares location, Kommunicate sends a custom event KOMMUNICATE_MEDIA_EVENT to your bot along with the attached file information. To have an upload intent respond to the KOMMUNICATE_MEDIA_EVENT, follow these steps to create this custom event in your dialogflow bot:

    How to add an event to an intent

    1. Go to the Events section of the intent.
    2. Type the name of the event you'd like your intent to respond to (KOMMUNICATE_MEDIA_EVENT).
    3. Press enter.
    4. Click SAVE.

    Also remember to add your response that the bot will deliver to a user when they upload a document.

    References:

    1. https://cloud.google.com/dialogflow/docs/events-overview
    2. https://docs.kommunicate.io/docs/bot-custom-integration#send-attachments-to-bot
    3. https://cloud.google.com/dialogflow/docs/quick/build-agent

    I hope this helps?