App SDK 2.0 Reference

Setup

The Hootsuite IFrame SDK is the communication gateway between your app and the Hootsuite dashboard. The SDK allows you to call functions that trigger user interface components in the Hootsuite dashboard and to receive Hootsuite dashboard events sent to your app.

Usage

To use the Hootsuite IFrame SDK, reference this file in your application. Do not make a copy of hsp.js as your app will not be supported and will break with updates made by Hootsuite

For example: <script src="https://assets.hootsuite.com/jsapi/4-0/hsp.js"></script>

App Server Setup

The Hootsuite IFrame SDK is built on the HTML5 window.postMessage API. This API sends data messages between two windows/frames across domains. As a result, your app server must allow HTTP POST requests to communicate using the underlying postMessage API.

Functions

The IFrame SDK has functions that trigger user interface components in the Hootsuite dashboard. The components that can be triggered are documented on this page.

Events

Communication from the Hootsuite dashboard to your app is enabled through events. Hootsuite will fire events when a user requests an action from your app. Your app can listen for events by calling the hsp.bind() function including the event name and a callback function that your app will execute when the event is triggered.

The following user triggered events are supported:

  • sendtoapp - Registering for this event will cause users to see a menu item reading "Send to {app name}" in Twitter, Facebook, and Instagram streams. This event fires when users click on the menu item for your app.
  • closepopup - This event fires when a custom popup opened by your app is closed.
  • refresh - This event fires when your app is refreshed. The event will be triggered either by the user clicking the refresh icon within the stream or as part of a page refresh.
  • savemessagetoapp - Registering for this event will cause users to see a menu item reading "Send to {app name}" in the save menu of the compose message box.
  • sendassignmentupdates - Registering for this event will notify your app of assignment updates