Why are these requests causing HTTP 422: Unprocessable Entity errors? | Community
Skip to main content

We are longtime users of Intercom’s API.  The majority of our requests to Intercom’s API succeed.  Here are examples of two payloads that consistently fail.

{
  "event_name": "new-feature-receive_this_response",
  "created_at": 1761447241,
  "user_id": "x12x227f8x4067cx7a5dx97x"
}
 
{
  "event_name": "experiments-show_experiment",
  "created_at": 1761447325,
  "user_id": "x12x227f8x4067cx7a5dx97x",
  "metadata": {
    "label": "experiment_questions"
  }
}
 
When they fail, Intercom’s API just returns a 422 with no additional details about the problem.
 
Reading through the docs, I can’t figure out what is wrong with these.  They both have event_name and created_at, the two required fields.  One has metadata, and one does not, but metadata is listed as optional, anyway.  I tried adjusting the event_names — replacing underscores with hyphens, truncating them &c., even trying a random string of 10 ascii chars, but these requests always still fail.  I got a coding agent to read through the docs, and it couldn’t figure out what I’m missing either.  I’m completely baffled — why are these failing?

A 422 from Intercom usually means the event timestamp (created_at) is invalid. The value 1761447241 is far in the future — Intercom expects a Unix timestamp near the current time (seconds since 1970). Try using Math.floor(Date.now() / 1000) or a current timestamp, and the requests should succeed.


Thanks for weighing in! 

But these are all valid Unix timestamps from last night…?

Your idea would suggest that all of my Intercom requests should be failing (and should have been failing for the past many years), but that is not the case.  Most of our calls go through—I can see this in our logs and within Intercom itself. 

For example, below I pasted a few that do consistently work (with timestamps computed in the same way as those that fail).

The ones that succeed and the ones that fail are consistent—it isn’t a random percentage that fail.  The examples from my earlier post always fail.  The ones I indicated below always succeed. 

 

{
  "event_name": "dataxyz-received",
  "created_at": 1761446735,
  "user_id": "xxx",
  "metadata": {
    "label": "xxx"
  }
}
{
  "user_id": "xxx",
  "unsubscribed_from_emails": false,
  "custom_attributes": {
    "last_dataxyz_received_at": 1761446735,
    "recipient": true
  }
}
{
  "event_name": "dataxyz-saved_draft",
  "created_at": 1761446735,
  "user_id": "xxx",
  "metadata": {
    "label": "xxx"
  }
}


I figured it out:  we hit the quota of 120 events.  I archived a bunch of unused events, and now all the failures have stopped.

This error message could be a LOT clearer!  Or documented somewhere more clearly, at least!