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

JsonMappingException while trying to get a contact by external Id

Open mahmoud811995 opened this issue 6 months ago • 1 comments

SDK version : 3.0.0

I already have a base of contacts stored with some basic data , and also a 'signed_up_at'. The issue is that the contacts already created with a signed_up_at in milliseconds cannot be fetched by the show contact by external id request, since the field signed_up_at is deserialized as integer :

Exception : Network error executing HTTP request
com.intercom.api.core.IntercomException: Network error executing HTTP request
	at com.intercom.api.resources.unstable.contacts.RawContactsClient.showContactByExternalId(RawContactsClient.java:947)
	at com.intercom.api.resources.unstable.contacts.ContactsClient.showContactByExternalId(ContactsClient.java:427)
...<REDACTED STACKTRACE>
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Numeric value (1675031978103) out of range of int (-2147483648 - 2147483647)
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 465] (through reference chain: com.intercom.api.resources.unstable.contacts.types.ShowContactByExternalIdResponse$Builder["signed_up_at"])
	at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:400)
	at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:359)
	at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.wrapAndThrow(BeanDeserializerBase.java:1966)
	at com.fasterxml.jackson.databind.deser.BuilderBasedDeserializer.vanillaDeserialize(BuilderBasedDeserializer.java:296)
	at com.fasterxml.jackson.databind.deser.BuilderBasedDeserializer.deserialize(BuilderBasedDeserializer.java:218)
	at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:342)
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4971)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3887)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3855)
	at com.intercom.api.resources.unstable.contacts.RawContactsClient.showContactByExternalId(RawContactsClient.java:928)
	... 79 common frames omitted
Caused by: com.fasterxml.jackson.core.exc.InputCoercionException: Numeric value (1675031978103) out of range of int (-2147483648 - 2147483647)
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 465]
	at com.fasterxml.jackson.core.base.ParserMinimalBase._reportInputCoercion(ParserMinimalBase.java:619)
	at com.fasterxml.jackson.core.base.ParserMinimalBase.reportOverflowInt(ParserMinimalBase.java:681)
	at com.fasterxml.jackson.core.base.ParserBase.convertNumberToInt(ParserBase.java:1059)
	at com.fasterxml.jackson.core.base.ParserBase._parseIntValue(ParserBase.java:981)
	at com.fasterxml.jackson.core.base.ParserBase.getIntValue(ParserBase.java:787)
	at com.fasterxml.jackson.databind.deser.std.NumberDeserializers$IntegerDeserializer.deserialize(NumberDeserializers.java:526)
	at com.fasterxml.jackson.databind.deser.std.NumberDeserializers$IntegerDeserializer.deserialize(NumberDeserializers.java:506)
	at com.fasterxml.jackson.databind.deser.std.ReferenceTypeDeserializer.deserialize(ReferenceTypeDeserializer.java:206)
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeSetAndReturn(MethodProperty.java:158)
	at com.fasterxml.jackson.databind.deser.BuilderBasedDeserializer.vanillaDeserialize(BuilderBasedDeserializer.java:294)
	... 85 common frames omitted

mahmoud811995 avatar Jun 30 '25 14:06 mahmoud811995

I have the same issue!

I've inspected the response payload and it looks like

{
  "type": "list",
  "data": [
    {
      "type": "contact",
      "id": "689e24142ed8d7bfed250db8",
      "workspace_id": "********",
      "external_id": "70009df9-312c-4fc5-9de3-8deda4cad668",
      "role": "user",
      "email": "[email protected]",
      "phone": null,
      "name": "Melvin Koopmans",
      "avatar": null,
      "owner_id": null,
      "social_profiles": {
        "type": "list",
        "data": []
      },
      "has_hard_bounced": false,
      "marked_email_as_spam": false,
      "unsubscribed_from_emails": false,
      "created_at": 1755194389,
      "updated_at": 1755196232,
      "signed_up_at": 1733844006105,
      "last_seen_at": 1755196232
    }
  ]
}

updated_at, created-at, last_seen_at all show the time in epoch seconds, which fits in an integer. Only signed_up_at is in milliseconds.

Could be a 'quick fix' to make it a Long instead, but seems like the root-cause is inconsistent formatting in the API itself.

melvinkoopmans avatar Aug 14 '25 19:08 melvinkoopmans