It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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
Answer accepted

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
Anatoli Atlassian Team Aug 17, 2016

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 in Hipchat

Hipchat Cloud and Stride have reached End of Life (updated)

All good things come to an end - thanks to all our customers and partners who have been along the Hipchat and Stride journey with us.  As of Feb 15th 2019, Hipchat Cloud and Stride have reached ...

35,198 views 9 8
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you