fix: integrate Typebot status change events for webhook in chatbot controller e service#1927
Merged
DavidsonGomes merged 2 commits intoEvolutionAPI:developfrom Sep 9, 2025
Conversation
…ntroller and service
Contributor
Reviewer's GuideThis PR hooks into Typebot session lifecycle events to emit TYPEBOT_CHANGE_STATUS webhooks by importing the new Events enum, constructing a standardized payload, and invoking sendDataWebhook in both the service and controller layers. Sequence diagram for Typebot status change webhook emissionsequenceDiagram
participant TypebotService
participant WAMonitoringService
participant waInstance
participant Webhook
TypebotService->>WAMonitoringService: On session open/close/delete
WAMonitoringService->>waInstance: sendDataWebhook(TYPEBOT_CHANGE_STATUS, typebotData)
waInstance->>Webhook: Emit webhook with status change
Class diagram for updated TypebotService and BaseChatbotControllerclassDiagram
class TypebotService {
-openaiService: OpenaiService
+constructor(waMonitor, configService, prismaRepository, openaiService)
+sendDataWebhook(Events.TYPEBOT_CHANGE_STATUS, typebotData)
}
class BaseChatbotController {
-integrationName: string
+sendDataWebhook(Events.TYPEBOT_CHANGE_STATUS, typebotData)
}
TypebotService --|> BaseChatbotService
BaseChatbotController <|-- ChatbotController
TypebotService o-- WAMonitoringService
TypebotService o-- OpenaiService
TypebotService o-- prismaRepository
BaseChatbotController o-- WAMonitoringService
BaseChatbotController o-- sessionRepository
BaseChatbotController o-- settingsRepository
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey there - I've reviewed your changes - here's some feedback:
- You’re repeating the same TYPEBOT_CHANGE_STATUS webhook emission logic in multiple branches—consider extracting it into a shared helper or method to DRY up the code.
- Avoid hardcoding status values across the service and controller; centralize them as constants or an enum to ensure consistency and prevent typos.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- You’re repeating the same TYPEBOT_CHANGE_STATUS webhook emission logic in multiple branches—consider extracting it into a shared helper or method to DRY up the code.
- Avoid hardcoding status values across the service and controller; centralize them as constants or an enum to ensure consistency and prevent typos.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
|
||
| const remoteJid = data.remoteJid; | ||
| const status = data.status; | ||
| const status = data.status; |
Contributor
There was a problem hiding this comment.
suggestion (code-quality): Prefer object destructuring when accessing and using properties. (use-object-destructuring)
Suggested change
| const status = data.status; | |
| const {status} = data; |
Explanation
Object destructuring can often remove an unnecessary temporary reference, as well as making your code more succinct.From the Airbnb Javascript Style Guide
Collaborator
|
Please fix the lint with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Does not trigger webhook for Typebot status change events (TYPEBOT_CHANGE_STATUS)
refactor(chatbot): unify keywordFinish type and enhance session handling
f9567fb
Related to issues:
Status de alteração do Typebot
#1382
Update Typebot Status (http request) session closed or deleted
#1390
Summary by Sourcery
Integrate TYPEBOT_CHANGE_STATUS webhook events into the chatbot flow by emitting session status changes (opened, closed, deleted, paused) from both the Typebot service and the base controller.
New Features: