HipChat - cURL Bold & Colors

Hello,

 

is there any way to forrmat the Text Bold or in Colors in HipChat messages?
Maybe even with the curl command? I would like to send messages in bold and colors...


curl -d '{"color":"green","message":"My first notification (yey)","notify":false,"message_format":"text"}' -H 'Content-Type: application/json' https://chat.XXX.XXX/v2/room/XX/notification?auth_token=XXXXX

 

Regards.

2 answers

1 accepted

1 vote
Accepted answer
Nick Turskyi Atlassian Team Jun 09, 2017

Hi Manuel,

You can use "message_format": "html" and use simple HTML formatting in the "message" field.

More information in the API call documentation: https://developer.atlassian.com/hipchat/guide/sending-messages

Regards,

Nick

Thanks perfect! This is working now! :D

Can i also color the messages? If i use <font color="#FF0099"> (eg) i get this error:

  "error": {
    "code": 400,
    "message": "The request body cannot be parsed as valid JSON: Expecting ',' delimiter or '}': line 1 column 132 (char 131)",
    "type": "Bad Request"

Any idea about this?

Nick Turskyi Atlassian Team Jun 09, 2017

Unfortunately, font tag isn't supported.

As per the documentation, "Allowed HTML tags: a, b, i, strong, em, br, img, pre, code, lists, tables".

As of the error, I'm pretty sure it's because you're using double quotes around the color, which effectively terminates the "message" field of JSON, which is itself enclosed in double quotes. Try escaping the inner quotes with backslashes:

"message":"My first<font color=\"#ff0099\"> notification</font>"

If I escape them the Message look like

My first<font color="#FF0099">notification</font>

but it is not in color.
Is there even a way to color them? Ive seen Screens where it was possible?

 

1 vote
Jeremy Atlassian Community Champion Jun 09, 2017

Dear Manuel,

For the regular Hipchat user this is not possible, see;

https://jira.atlassian.com/browse/HCPUB-300

Although it is possible in certain situations with Nick his answer.

Friendly Regards,

Jeremy

Thank you! :D

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...

525 views 0 2
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