Hi.

I'm new to HipChat API and I'm trying to make a simple slashcommand which returns a card. What am I doing wrong here (PHP file):

 

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "[REMOVED]");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array(
  'color' => 'gray',
  'message' => 'Test message',
  'notify' => true,
    'card' => array(
        'title' => 'Test card',
        'format' => 'compact',
        'style' => 'application',
        'url' => '[REMOVED]',
        'description' => 'lorem impsum',
        'id' => '234567890'
    ),
  'message_format' => 'html'
)));

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec ($ch);
curl_close ($ch);

 

All help is appreciated.

2 answers

This widget could not be displayed.

Morten, the format looks ok. Do you actually see 'Test message' but not card? What does HipChat return, any errors?

This widget could not be displayed.

250

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published Friday in Hipchat

What should I think about when migrating HipChat to Slack?

...from the beginning. We have built up a lot of content in HipChat, with it being a core tool in our distributed company model. While it is true that we didn’t need to move to Slack immediately, we felt it...

229 views 1 9
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