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

How to post a card using Hipchat api

Hi,

I've wrote a quick python code to POST cards following the documentation page example (https://developer.atlassian.com/hipchat/guide/hipchat-ui-extensions/cards) but I am unable to see the card in the client (Mac OS X) although a HTTP 204 code is returned from the server.

May be somebody could provide me a working example?

Thanks.

My code:

 

#!/usr/bin/env python

import json
import requests

headers = { 'Content-Type' : 'application/json' }
card = {
  "style": "link",
  "url": "http://i0.kym-cdn.com/photos/images/newsfeed/000/131/786/tumblr_ljkeuyjp1a1qafrh6.gif",
  "id": "fee4d9a3-685d-4cbd-abaa-c8850d9b1960",
  "title": "My test",
  "description": {
    "format": "html",
    "value": "<b>Add-on link:</b> <a href='#' data-target='hip-connect-tester:hctester.dialog.simple' data-target-options='{\"options\":{\"title\":\"Custom Title\"}, \"parameters\":{\"from\":\"link\"}}'>Open Dialog with parameters</a>"
  },
  "icon": {
    "url": "http://icons.iconarchive.com/icons/designbolts/hand-stitched/24/RSS-icon.png"
  },
  "date": 1443057955792
}

data_json = { 'message' : '<b>test1<b>', 'card': card, 'message_format' : 'html' }

params = { 'auth_token' : '[REMOVED]' }

r = requests.post('https://[REMOVED].hipchat.com/v2/room/[REMOVED]/notification', data=json.dumps(data_json), headers=headers, params=params)
print r



 

 

3 answers

1 accepted

2 votes
Answer accepted
rich Atlassian Team Jan 13, 2016

Are you using the new Mac beta client? Cards aren't supported with the current stable mac release. Another way to see the cards are through the web app: https://hipchat.com/chat

Yes, you are right. I see the cards in the web interface not in the mac client.

Thanks!

 

Will be able to use curl command to generate a card

I am facing the same issue. I am able to post the card. But when i click the link on the card the parameters are not passed in the link. I also tried by using urlTemplateValues.

I want to pass parameter to the URL Link. Can you guys please help me.

Suggest an answer

Log in or Sign up to answer
TAGS
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,195 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