Sending a Card to a HipChat room always returns 400: "Value {value!r} is not of type {expected_type!r}"

This question is in reference to Atlassian Developer Documentation: Sending Messages

No matter how I change the JSON I always get the response:

"Value {value!r} is not of type {expected_type!r}"

But as you can see, the placeholders are not replaced by what actually is wrong. No matter what I change or remove, the error remains the same. If I just send a message to the room, everything works fine. The generated JSON looks like this:

  "id": "8c50988a-ef54-4884-ad67-b86b41e1c366", 
  "style": "application", 
  "title": "Notify Me Here", 
  "format": "medium", 
  "description": "You've been notified", 
  "url": "", 
  "attributes": [{
    "label": "Nick", 
    "value": {"style": "lozenge-complete", 
              "label": "FancyBot"}
  "icon": {"url": ""}

3 answers

1 accepted

0 votes
Accepted answer

Ok, I'm a fool! I admit it. The thing about the REST Client App getting things at least half-way right was bugging me. So while having had another 30min. time to spend on this, I looked at the request data that I was actually sending and figured that the content-type header 


 wasn't added and the body data not properly converted to json (as I've nicely done that in the wrong location, I should wear my glasses more often . . .). After I fixed that, it worked.

@Anatoli Kazatchkov thanks for looking into this. This is fixed now.

0 votes

I have just tested your JSON and it worked as expected for me:

image2016-8-18 15:34:43.png

Are you setting the card field of the message to the JSON you listed? The whole message

"message": "fallback message for old clients that cannot render cards",
"card": {....}

The whole format can be found here.

Hello @Anatoli Kazatchkov

thanks for the response. The whole body would look like this:


  "color": "green",
  "notify": "true", 
  "card": {
    "id": "9784aa87-c950-41c3-b164-4a4f4aa76d40",
    "icon": {
      "url": ""},
      "style": "application",
      "format": "medium",
      "attributes": [{
        "value": {
          "style": "lozenge-complete",
          "label": "FancyBot"},
        "label": "Nick"
      "title": "Maniac",
      "description": {
        "value": "You\'re a Maniac for Python",
        "format": "html"}},
  "message": " wrote:\nJava?"

After removing the three other parameters:

"color": "green",
"notify": "true"

The room will render the icon as an image but post the rest of the body as text. So the message is accepted now, but just not as a card. And only if I use a REST Client App for testing purposes. The code itself will send a body that still is rejected. But there is a phrase in my language that loosely translates to "Those who can read \[Error Messages\] have a clear advantage" . . .

The actual error message I get is:

"message": "Value u'attributes' for field 'card' is not of type [{'type': 'null'}, ...

Now that's strange . . .

UPDATE: I figured that the message is random. If I restart the application it's just another value for the field 'card' that's dubbed not of type. E.g.:


"Value u'id' for field 'card' is not of type [{'type': 'null'}

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 14, 2018 in Hipchat Cloud

Hipchat Cloud and Stride End of Life: Just over 90 days away

Earlier this year we made the difficult decision to discontinue our team messaging tools, Stride and Hipchat. The end of life date for Stride and Hipchat Cloud is quickly approaching - February 15, 2...

28,515 views 0 7
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you