python-intercom icon indicating copy to clipboard operation
python-intercom copied to clipboard

Event metadata validation is too strict

Open jpvanhal opened this issue 2 months ago • 0 comments

CreateDataEventRequest models (CreateDataEventRequestWithId, CreateDataEventRequestWithUserId, CreateDataEventRequestWithEmail) only accept string metadata, conflicting with Intercom’s documented metadata types (strings, numbers, Unix timestamps, rich links, monetary amounts).

Steps to reproduce

  1. Instantiate any variant with non-string metadata:
from intercom.types import CreateDataEventRequestWithUserId

CreateDataEventRequestWithUserId(
    user_id="123",
    event_name="test-event",
    created_at=1671028894,
    metadata={"load": 3.67},
)
  1. Observe ValidationError because metadata.load is not a string.

Expected behaviour

Allow every metadata type listed at https://developers.intercom.com/docs/references/rest-api/api.intercom.io/data-events/createdataevent.

Actual behaviour

Validation forces all metadata values to be plain strings.

Suggested Fix

Relax the metadata value type in all CreateDataEventRequest* models (e.g., use typing.Any or a union covering the documented types) so the SDK aligns with Intercom’s API specification.

jpvanhal avatar Nov 19 '25 09:11 jpvanhal