Message archives are available to you via a callback API that is implemented on your end. This API is hit with a payload on an interval to deliver the messages that occurred since the last interval. This delivery is done in the form of an XML packet as post data delivered over HTTP. The callback method involved is sendArchive and details on how to implement can be found below:
Sends a list of archived messages including join/leave notifications. This method will be called every 60 seconds.
SendArchive will send you two distinct types of packets. Though very similar these packets will need to be handled differently or else one of them ignored. We send one packet which contains all sent instant messages (“chat”) on an interval. The second type of packet we send is per room (“muc”), this packet will contain all the messages sent inside of a room based on the same interval. It is important to know that this difference will show up as different XML and you will need to parse the data appropriately based on the type of packet.
| Arguments | Value |
|---|---|
| function | sendArchive |
| domainID | The identifier for the domain the user is on. |
| type | The type of sendArchive packet. Possible values are chat, and muc. |
| callID | A unique identifier for this XML call. |
| xmlData | A FORM variable that contains the archive data (example shown below). |
| Returns | nothing |
|---|
This request is made as a FORM POST (all parameters are still on the query string, though) and a single FORM element of ‘xmlData’ is sent in the following format:
<?xml version='1.0' encoding='utf-8'?>
<messageArchive type="muc" callID="123123">
<room>
<name><![CDATA[asfd]]></name>
<messages>
<entry type="leave">
<timestamp>1126551110781</timestamp>
<userID invisible="false">1</userID>
</entry>
<entry type="join">
<timestamp>1126551112343</timestamp>
<userID invisible="false">1</userID>
</entry>
<entry type="msg">
<timestamp>1126551127685</timestamp>
<userID invisible="false">1</userID>
<content><![CDATA[this is my message]]></content>
</entry>
</messages>
</room>
</messageArchive>
This request is made as a FORM POST (all parameters are still on the query string, though) and a single FORM element of ‘xmlData’ is sent in the following format:
<?xml version='1.0' encoding='utf-8'?>
<messageArchive type="chat" callID="123123">
<messages>
<message>
<from>1</from>
<to>1</to>
<timestamp>1126551127685</timestamp>
<content><![CDATA[this is my message]]></content>
</message>
</messages>
</messageArchive>
If you are using ASP.NET, you will need to make sure the following line is at the top of your CSXML page:
<%@ Page Language="C#" ValidateRequest="false" %>