0

I am using aws lambda to respond to a Dialogflow webhook via API gateway. I have added the webhook in fulfillment using basic auth. The lambda is successfully called (based on Cloudfront logs) and it returns a fulfillment_text response;

exports.handler = async (event, context) => {
    return { fulfillmentText: 'IT WORKS' };
};

For some reason, I always get:

API RESPONSE

  "webhookStatus": {
    "code": 13,
    "message": "Webhook call failed. Error: 502 Bad Gateway."
  }

Dialogflow documentation

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Ioannis Tsiokos
  • 835
  • 1
  • 12
  • 14
  • I have followed the directions at https://medium.com/faun/building-chatbot-with-google-dialogflow-with-aws-lambda-e19872e1589 and used the dialogflow fulfillment library with expresss. I was hoping to avoid using so many libraries and just handle json, but it works... – Ioannis Tsiokos Nov 03 '19 at 17:29

1 Answers1

0

I was able to pull it off w/out the need for express. I hope this helps.

{
    const { dialogflow,SimpleResponse,BasicCard,Image,Suggestions,MediaObject,SignIn,Permission } = require('actions-on-google');

    const app = dialogflow({debug:true, clientId: process.env.dialogFlowClientID});

    app.intent('Default Welcome Intent', (conv) => {
        conv.ask('You made it you rock star');
    });


    exports.lambdaHandler = app
}
Adrian Mole
  • 49,934
  • 160
  • 51
  • 83