POST API Details (XML)
(Last Updated On: October 7, 2014)

Event API details

When the API is activated and a new contact request is received, SnapEngage will automatically send a POST transaction to the URL specified in the API configuration. The transaction provides details about the request in an XML format.

POST event details:

<?xml version="1.0" encoding="UTF-8"?>
<case>

  <id><![CDATA[8b7c3b3b-f5d7-4e58-96d8]]></id>
  <url>http://www.snapengage.com/viewcase?c=8b7c3b3b-f5d7-4e58-96d8</url>
  <snapshot_image_url>http://www.snapengage.com/snapabug/ServiceImage?c=8b7c3b3b-f5d7-4e58-96d8</snapshot_image_url>
  <requested_by><![CDATA[test@test.com]]></requested_by>
  <description><![CDATA[Testing the Open API...]]></description>
  <created_at type="datetime">2010-10-18T01:48:18.623Z</created_at>
  <page_url>http://www.snapengage.com/demo/postapi.html></page_url>
  <ip_address>67.174.108.196</ip_address>
  <browser>Chrome (6.0.472.63)</browser>
  <os>Microsoft Windows 7</os>
  <country_code>US</country_code>
  <country>United States</country>
  <region>CO</region>
  <city><![CDATA[Boulder]]></city>
  <latitude>39.914700</latitude>
  <longitude>-105.080902</longitude>
  <source_id type="integer">2</source_id>

  <languages type="array">
    <language>
      <name><![CDATA[English]]></name>
      <code><![CDATA[en-US]]></code>
    </language>
    <language>
      <name><![CDATA[German]]></name>
      <code><![CDATA[de-DE]]></code>
    </language>
  </languages>

  <plugins type="array">
    <plugin>
      <name>Flash</name>
      <value>10.0.45</value>
    </plugin>
    <plugin>
      <name>Java</name>
      <value>1.6</value>
    </plugin>
  </plugins>

  <javascript_variables type="array">
    <javascript_variable>
      <name><![CDATA[userid]]></name>
      <value><![CDATA[ab123456789]]></value>
    </javascript_variable>
  </javascript_variables>

  <operator_variables type="array">
   <operator_variable>
     <name><![CDATA[note]]></name>
     <value><![CDATA[this is a note entered by the agent]]></value>
    </operator_variable>
  </operator_variables>

  <transcripts type="array">
    <transcript>
      <id>jerome@snapengage.com</id>
      <date type="datetime">Mon Oct 18 01:48:27 UTC 2010</date>
      <alias>test</alias>
      <message>Hello, </message>
    </transcript>
    <transcript>
      <id></id>
      <date type="datetime">Mon Oct 18 01:48:32 UTC 2010</date>
      <alias>visitor</alias>
      <message>Hi,</message>
    </transcript>
    <transcript>
      <id></id>
      <date type="datetime">Mon Oct 18 01:48:41 UTC 2010</date>
      <alias>visitor</alias>
      <message>This is a test.</message>
    </transcript>
    <transcript>
      <id>jerome@snapengage.com</id>
      <date type="datetime">Mon Oct 18 01:48:49 UTC 2010</date>
      <alias>test</alias>
      <message>ok. thank's for testing. </message>
    </transcript>
  </transcripts>

  <chat_waittime type="integer">2</chat_waittime>
  <chat_duration type="integer">15</chat_duration> 
  <referrer_url><![CDATA[http://refering.url/]]></referrer_url>
  <entry_url><![CDATA[http://entry.url/]]></entry_url> 

 </case>

Additional information

source_id: The tag source_id has an integer value of 1 when the SnapEngage interaction was a simple offline message, and 2 when it was a live chat session.

retries: The target system needs to respond with and HTTP 200 to confirm that the event has been received and processed. In the absence of a successful HTTP response, SnapEngage will retry the HTTP POST automatically for approximately 2 hours before sending it through email and flagging the event as sent.

using PHP: The XML content is a stream in XML format. You can not access this stream in the $_* variables of PHP. Please use this instead:

$xml = fopen("php://input","r");