Skip to content

fix: correçao do typebot não conseguir ouvir mensagens de input #1670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2025

Conversation

Santosl2
Copy link

@Santosl2 Santosl2 commented Jun 29, 2025

Esse PR corrige o erro Cannot read properties of undefined (reading 'applyFormatting') que ocorre quando o Typebot envia mensagens que o usuário precisa inserir uma resposta.

image

Copy link
Contributor

sourcery-ai bot commented Jun 29, 2025

Reviewer's Guide

Ensure the applyFormatting callback passed into processMessages is bound to the service instance so its internal context is preserved.

Class diagram for TypebotService applyFormatting binding fix

classDiagram
    class TypebotService {
        +applyFormatting()
    }
    class processMessages {
        <<function>>
        +applyFormattingCallback
    }
    TypebotService --|> BaseChatbotService
    TypebotService : calls processMessages(..., applyFormatting.bind(this), ...)
    processMessages : uses applyFormattingCallback
Loading

File-Level Changes

Change Details Files
Bind applyFormatting method to maintain correct context
  • Replaced passing this.applyFormatting with this.applyFormatting.bind(this) in processMessages call
src/api/integrations/chatbot/typebot/services/typebot.service.ts

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Santosl2 - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Santosl2 Santosl2 changed the base branch from main to develop June 29, 2025 23:25
@Santosl2 Santosl2 changed the title fix: bind applyFormatting method in processMessages to maintain context fix: correçao do typebot não conseguir ouvir mensagens de input Jun 30, 2025
@gtjadsonsantos
Copy link

Isso resolve também a questão de quando é feito uma requisição por dentro do typebot e apartir desse retorno é criado algumas variáveis mapeando valores dessa requisição e mostrando no bubble de texto ele também não consegue exibir

@Santosl2
Copy link
Author

Isso resolve também a questão de quando é feito uma requisição por dentro do typebot e apartir desse retorno é criado algumas variáveis mapeando valores dessa requisição e mostrando no bubble de texto ele também não consegue exibir

Não estou ciente desse problema.. Essa correção apenas resolve a questão que quando tem uma mensagem que o usuário precisa responder o bot para de funcionar.

Exemplo: No seu fluxo você pergunta pro usuário qual o nome dele e aguarda ele a responder. Quando o usuário responde, o bot para de responder, pois da erro no servidor.

Com essa correção o bot volta a responder normalmente

@gtjadsonsantos
Copy link

Também existe essa situação

Captura de Tela 2025-06-30 às 13 56 14

Ele não consegue mostrar o dado que retornou na api

@gtjadsonsantos
Copy link

Quando inicio o flow pelo chat do typebot aquele via navegador, mostra tranquilo.

@Santosl2
Copy link
Author

Também existe essa situação

Captura de Tela 2025-06-30 às 13 56 14 Ele não consegue mostrar o dado que retornou na api

Hmm, esse aí não faço ideia eheh. Se puder me mandar mensagem no discord depois pra eu entender o discord é @Santosl2c
Por hora esse commit corrige apenas o erro informado, recomendo que abra uma issue para essa situação aí por gentileza, pois o meu fix não tem a ver com isso

@gtjadsonsantos
Copy link

Isso resolve também a questão de quando é feito uma requisição por dentro do typebot e apartir desse retorno é criado algumas variáveis mapeando valores dessa requisição e mostrando no bubble de texto ele também não consegue exibir

Na v2.2.2 esse problema não ocorre

@DavidsonGomes DavidsonGomes merged commit c7b5abc into EvolutionAPI:develop Jul 1, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants