botpress/botpress-api.ai

Support with botpress-platform-webchat

Opened this issue · 0 comments

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
      }
    })