Skip to content

Conversation

@jacksonvieiracs
Copy link

@jacksonvieiracs jacksonvieiracs commented Dec 3, 2025

Fixes #8

Summary by Sourcery

Update chat service endpoints and formatting for WhatsApp-related operations.

Bug Fixes:

  • Correct the endpoint used by check_is_whatsapp_numbers to call the whatsappNumbers API path.

Enhancements:

  • Standardize string quoting and method formatting across ChatService methods for improved readability.

@sourcery-ai
Copy link

sourcery-ai bot commented Dec 3, 2025

Reviewer's Guide

Updates the ChatService.check_is_whatsapp_numbers endpoint path to the new whatsappNumbers URL and performs minor, consistent style cleanups across chat-related methods (string quoting, trailing commas, and line wrapping).

Sequence diagram for updated check_is_whatsapp_numbers endpoint

sequenceDiagram
    actor Caller
    participant ChatService
    participant HttpClient
    participant EvolutionAPI

    Caller->>ChatService: check_is_whatsapp_numbers(instance_id, data, instance_token)
    ChatService->>HttpClient: post(path=chat/whatsappNumbers/{instance_id}, data=data.__dict__, instance_token)
    HttpClient->>EvolutionAPI: POST /chat/whatsappNumbers/{instance_id}
    EvolutionAPI-->>HttpClient: Response
    HttpClient-->>ChatService: Response
    ChatService-->>Caller: Response
Loading

Class diagram for ChatService chat methods

classDiagram
    class ChatService {
        +client
        +__init__(client)
        +check_is_whatsapp_numbers(instance_id, data, instance_token)
        +mark_message_as_read(instance_id, messages, instance_token)
        +archive_chat(instance_id, data, instance_token)
        +mark_chat_unread(instance_id, data, instance_token)
        +delete_message_for_everyone(instance_id, data, instance_token)
        +fetch_profile_picture_url(instance_id, data, instance_token)
        +get_base64_from_media_message(instance_id, data, instance_token)
        +update_message(instance_id, data, instance_token)
        +send_presence(instance_id, data, instance_token)
        +get_messages(instance_id, remote_jid, instance_token, message_id, whatsapp_message_id, from_me, type, from, ack, body, source, timestamp_start, timestamp_end, page, offset)
    }

    class HttpClient {
        +post(path, data, instance_token)
        +delete(path, data, instance_token)
    }

    class CheckIsWhatsappNumber
    class ReadMessage
    class ArchiveChat
    class UnreadChat
    class MessageKey
    class ProfilePicture
    class MediaMessage
    class UpdateMessage
    class Presence

    ChatService --> HttpClient : uses
    ChatService --> CheckIsWhatsappNumber : check_is_whatsapp_numbers data
    ChatService --> ReadMessage : mark_message_as_read messages
    ChatService --> ArchiveChat : archive_chat data
    ChatService --> UnreadChat : mark_chat_unread data
    ChatService --> MessageKey : delete_message_for_everyone data
    ChatService --> ProfilePicture : fetch_profile_picture_url data
    ChatService --> MediaMessage : get_base64_from_media_message data
    ChatService --> UpdateMessage : update_message data
    ChatService --> Presence : send_presence data
Loading

File-Level Changes

Change Details Files
Update the WhatsApp numbers verification endpoint to use the new whatsappNumbers route.
  • Change check_is_whatsapp_numbers to POST to the chat/whatsappNumbers/{instance_id} URL instead of chat/checkIsWhatsappNumber/{instance_id}.
  • Keep request payload as data.dict and pass instance_token unchanged.
evolutionapi/services/chat.py
Normalize formatting in ChatService methods for readability and consistency.
  • Reformat multiple method signatures (e.g., check_is_whatsapp_numbers, mark_message_as_read, delete_message_for_everyone, get_base64_from_media_message) to span multiple lines with one argument per line where needed.
  • Switch string literals used in client.post and client.delete calls from single quotes to double quotes and add trailing commas to argument lists.
  • Tidy get_messages docstring to use triple double quotes and adjust whitespace (spaces, blank lines, and alignment) without changing logic or behavior.
evolutionapi/services/chat.py

Assessment against linked issues

Issue Objective Addressed Explanation
#8 Update ChatService.check_is_whatsapp_numbers to call the endpoint 'chat/whatsappNumbers/{instance_id}' instead of 'chat/checkIsWhatsappNumber/{instance_id}'.

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

@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 there - 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.

@jacksonvieiracs jacksonvieiracs changed the title fix: update ChatService.check_is_whatsapp_numbers url. Fixes #8 fix: update ChatService.check_is_whatsapp_numbers url. Dec 3, 2025
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.

Error in client.post URL - ChatService

1 participant