Skip to content

WhatsApp resource methods build a double /v2/v2/ path → 404 (v4.168.0) #402

Description

@paulmartins

Summary

Every method under the whatsapp.* resource group builds a request URL with a doubled version prefix (/v2/v2/...), causing a 404 (10005 – Resource not found). The whatsapp.* path templates include a leading /v2, but the client's base_url already ends in /v2 — so they compound. Non-WhatsApp resources are correct and unaffected.

Version

  • telnyx 4.168.0 (Python)
  • Default base_url: https://api.telnyx.com/v2/

Reproduction

import telnyx
client = telnyx.Telnyx(api_key="...")
client.whatsapp.business_accounts.phone_numbers.initialize_verification(
    "test_waba_id",
    phone_number="test_phone_number",
    display_name="Example",
    verification_method="sms",
)

Actual request URL:

https://api.telnyx.com/v2/v2/whatsapp/business_accounts/test_waba_id/phone_numbers

404 {'errors': [{'code': '10005', 'title': 'Resource not found', ...}]}

Expected:

https://api.telnyx.com/v2/whatsapp/business_accounts/test_waba_id/phone_numbers

Root cause

The whatsapp.* path templates start with /v2, unlike every other resource, which is relative to the already-versioned base_url:

Method Path template in SDK
phone_numbers.messaging.update /phone_numbers/{id}/messaging ✅ (no /v2)
whatsapp.business_accounts.phone_numbers.initialize_verification /v2/whatsapp/business_accounts/{id}/phone_numbers
whatsapp.business_accounts.phone_numbers.list /v2/whatsapp/business_accounts/{id}/phone_numbers
whatsapp.phone_numbers.verify /v2/whatsapp/phone_numbers/{phone_number}/verify

(Likely all whatsapp.* methods are affected; the three above are what I use.)

Suggested fix

Strip the leading /v2 from the whatsapp.* path templates so they're relative to base_url like every other resource. This looks like an
OpenAPI-spec/codegen inconsistency where the WhatsApp paths were specified with the version segment included.

Workaround

Construct a separate client with the host root as the base URL for WhatsApp calls:

wa = telnyx.Telnyx(api_key="...", base_url="https://api.telnyx.com")
wa.whatsapp.business_accounts.phone_numbers.initialize_verification(...)  # → single /v2, works

(Can't be used for the whole client, since it would then break the correctly-pathed non-WhatsApp resources.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions