XMPP Card Custom Stanza

Hi,

I am the author of a xmpp chatbot that uses HipChat. I am trying to send a custom stanza using xmpp to create an application card (https://developer.atlassian.com/hipchat/guide/sending-messages) instead of using the rest api. I cannot find any documentation on how to do this. I see that HipChat supports xhtml-im (per https://answers.atlassian.com/questions/38838139) but I do not know what the server expects to create an application card.

I am able to create the application card through the rest api with the following json payload:

{
  "color": "purple", 
  "message_format": "text", 
  "message": "my message",
  "notify": false,
  "card": {
    "style": "application",
    "format": "compact",
    "url": "https://www.atlassian.com",
    "id": "c253adc6-11fa-4941-ae26-7180d67e814a",
    "title": "My Title",
    "description": "My description",
    "date": 1453867674631,
    "thumbnail": {
      "url": "https://www.atlassian.com/docroot/wac/resources/wac/img/social-icons/atlassian_logo.jpg",
      "url@2x": "https://www.atlassian.com/docroot/wac/resources/wac/img/social-icons/atlassian_logo.jpg",
      "width": 400,
      "height": 200
    },
    "attributes": [
      {
        "label": "swapv3",
        "value": {
          "label": "test",
          "url": "https://answers.atlassian.com"
        }
      },
      {
        "label": "console",
        "value": {
          "label": "link2",
          "url": "https://answers.atlassian.com"
        }
      }
    ]
  }
}

 

I can see my xmpp client receiving the following stanza after sending the above:

<message from="a_jabber_channel_id" type="groupchat" to="other_jabber_channel_id">
  <body>my message</body>
  <x xmlns="http://hipchat.com/protocol/muc#room">
    <type>system</type>
    <notify>0</notify>
    <color>purple</color>
    <message_format>text</message_format>
    <card>
      <raw>{"style": "application", "description": "My description", "format": "compact", "url": "https://www.atlassian.com", "title": "My Title", "id": "c253adc6-11fa-4941-ae26-7180d67e814a", "date": 1453867674631, "attributes": [{"value": {"url": "https://answers.atlassian.com", "label": "test"}, "label": "swapv3"}, {"value": {"url": "https://answers.atlassian.com", "label": "link2"}, "label": "console"}], "validation": {"safehtmls": ["activity.html"], "safeurls": ["url", "images.image", "images.image-small", "images.image-big", "icon.url", "icon.url@2x", "icon", "thumbnail.url@2x", "thumbnail.url"]}, "thumbnail": {"url": "https://www.atlassian.com/docroot/wac/resources/wac/img/social-icons/atlassian_logo.jpg", "width": 400, "url@2x": "https://www.atlassian.com/docroot/wac/resources/wac/img/social-icons/atlassian_logo.jpg", "height": 200}}</raw>
    </card>
    <notification_sender type="user" id="jabber_id" />
  </x>
</message>

The question is.. how can I construct a valid xmpp stanza to mimic the rest api?

Thanks.

1 answer

1 accepted

This widget could not be displayed.

Unfortunately, generating card-style messages is only possible through the API interface. The XMPP interface is limited to text/html formats. In order to generate a card message, clients can either call the API directly, or perform some kind of interaction with an addon, which then sends the card message on behalf of the client.

Thanks for the reply Chris.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 10, 2018 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...

416 views 1 10
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