Rasa nlu not working on messenger channel

I am trying to add rasa to the messenger in the bot.

I have used following hook : -

   * This is an example of how to use Rasa NLU instead of Botpress NLU
   * To enable this, remove the 'dot' before the name of this file

  const axios = require('axios')

  const eventTypes = ['text'] // Process only 'text' events

  async function rasaExtract() {
    if (eventTypes.includes(event.type)) {
      const { data } = await axios.post('http://localhost:5005/model/parse?token=thisismysecret', {
        text: event.preview,
        message_id: 'b2831e73-1407-4ba0-a861-0f30a42a2a5a'
      if (data) {

        /** TODO Here you will need to manipulate the format of these objects
         * so that they use the same format as Botpress NLU */
        event.nlu = event.nlu || {}
        //event.nlu.intents = data.intent_ranking;
        event.nlu.intent = {}
        if (data.intent.name) event.nlu.intent.name = data.intent.name
        else event.nlu.intent.name = 'none'

        bp.logger.info('rasa-1 response intent : ' + event.nlu.intent.name)

        //event.nlu.entities = data.entities
        //event.nlu.language = data.results.language
        //event.nlu.sentiment = data.results.sentiment
        // Disable Native NLU
        event.setFlag(bp.IO.WellKnownFlags.SKIP_NATIVE_NLU, true)

  return rasaExtract()

It is working on other channels but not getting intent on the messenger channel, How can I achieve that?

At what stage does your hook runs ?


@frank_levasseur It runs at before_incoming_middleware