Adicionando um novo webhook no endpoint de updateMessage#1343
Conversation
Reviewer's Guide by SourceryThis pull request introduces the Sequence diagram for updateMessage endpoint with SEND_MESSAGE_UPDATE webhooksequenceDiagram
participant Client
participant BaileysService
participant WhatsApp
participant WebhookService
Client->>BaileysService: /chat/updateMessage/
BaileysService->>WhatsApp: sendMessage (edit)
activate WhatsApp
WhatsApp-->>BaileysService: messageSent
deactivate WhatsApp
BaileysService->>WebhookService: sendDataWebhook(SEND_MESSAGE_UPDATE, updatedMessage)
activate WebhookService
WebhookService-->>BaileysService: Success
deactivate WebhookService
BaileysService-->>Client: messageSent
Updated class diagram for ConfigServiceclassDiagram
class ConfigService {
+EventsRabbitmq: object
+EventsWebhook: object
+EventsPusher: object
+constructor()
+get<T>(propertyPath: string): T
}
class EventsRabbitmq {
+MESSAGES_UPDATE: boolean
+MESSAGES_DELETE: boolean
+SEND_MESSAGE: boolean
+SEND_MESSAGE_UPDATE: boolean
+CONTACTS_SET: boolean
+CONTACTS_UPDATE: boolean
+CONTACTS_UPSERT: boolean
}
class EventsWebhook {
+MESSAGES_UPDATE: boolean
+MESSAGES_DELETE: boolean
+SEND_MESSAGE: boolean
+SEND_MESSAGE_UPDATE: boolean
+CONTACTS_SET: boolean
+CONTACTS_UPDATE: boolean
+CONTACTS_UPSERT: boolean
}
class EventsPusher {
+MESSAGES_UPDATE: boolean
+MESSAGES_DELETE: boolean
+SEND_MESSAGE: boolean
+SEND_MESSAGE_UPDATE: boolean
+CONTACTS_SET: boolean
+CONTACTS_UPDATE: boolean
+CONTACTS_UPSERT: boolean
}
ConfigService -- EventsRabbitmq : has
ConfigService -- EventsWebhook : has
ConfigService -- EventsPusher : has
Updated class diagram for Events enumclassDiagram
class Events {
<<enumeration>>
MESSAGES_UPDATE
MESSAGES_DELETE
SEND_MESSAGE
SEND_MESSAGE_UPDATE
CONTACTS_SET
CONTACTS_UPSERT
CONTACTS_UPDATE
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @pedro-php - I've reviewed your changes - here's some feedback:
Overall Comments:
- It's great to see the addition of the
SEND_MESSAGE_UPDATEevent to maintain consistency across the API. - Ensure that the new
SEND_MESSAGE_UPDATEevent is handled gracefully when it fails, and that the user is notified.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
A branch correta é a |
FixProblemaA aplicação estava gerando erros ao realizar a build a partir da branch O que foi alteradoFoi ajustada a conversão do timestamp, que pode ser do tipo ResoluçãoAgora é possível realizar a build da branch MergeO que foi alteradoA branch
A primeira ação foi mantida. Já na segunda, foram feitas alterações para tornar o webhook consistente com o evento Além disso, o novo webhook ResoluçãoAgora, ao criar ou editar uma instância, o usuário pode adicionar o webhook Essa alteração melhora a consistência da API, padronizando o comportamento dos endpoints, já que um webhook já é disparado ao enviar uma mensagem. SugestãoRemovi o envio da mensagem antiga no endpoint de atualização ( |
Feature
Problema
Ao se editar uma mensagem, utilizando o endpoint de
updateMessage, nenhum webhook de confirmação de sucesso é enviado pela API. Webhooks são apenas enviados quando uma mensagem é editada no dispositivo conectado.O que foi alterado
Foi adicionado o evento
send.message.update, que é disparado pelo webhookSEND_MESSAGE_UPDATE, no endpoint/chat/updateMessage/. Este evento e este webhook foram também adicionados às integrações com o RabbitMQ, CHATWOOT e no evento de criação e edição de instância.Resolução
O usuário pode agora, ao criar ou editar uma instância, adicionar o webhook
SEND_MESSAGE_UPDATEà ela. Este webhook é disparado ao se realizar à chamada ao endpoint/chat/updateMessage/em caso de sucesso. Esta alteração melhora a consistência da API, padronizando o comportamento dos endpoints, já que um webhook já é disparado ao enviar uma mensagem.Summary by Sourcery
Add a new webhook for message update events in the API
New Features:
SEND_MESSAGE_UPDATEfor successful message updates in the APIEnhancements:
Chores: