botpress / botpress-api.ai

☠ 301 – Moved here (user Botpress NLU) --->
https://github.com/botpress/modules
GNU General Public License v3.0
14 stars 10 forks source link

Support with botpress-platform-webchat #25

Open bighelmet7 opened 6 years ago

bighelmet7 commented 6 years ago

To run api.ai on botpress-platform-webchat you only need to edit index.js the sendOutgoing with the follow:

    event.bp.middlewares.sendOutgoing({
      type: 'text',
      platform: event.platform,
      text: result.fulfillment.speech,
      user: { id: event.user.id }
      raw: {
        to: event.user.id,
        message: result.fulfillment.speech,
        channelId: event.platform !== 'slack' ? null : event.channel.id,
        options: event.platform !== 'slack' ? null : {},
        conversationId: event.raw.conversationId ? event.raw.conversationId : null
      }
    })