Engagement API

Documentation

The HootSuite Engagement API is located at https://api.hootsuite.com/api/2/

Authentication with the API is based on OAuth 2. Make sure to read the OAuth 2 documentation to learn about how to obtain Access Tokens and how you use them in requests against the API.

Note: While some endpoints don't require user authorization (example: provisioning a new HootSuite member via POST /members), you still need to present a valid Access Token to authenticate your App against the respective endpoint. We suggest you obtain an Access Token using your own member account to represent your App.

messages

The /messages endpoint provides access to HootSuite's rich publishing capabilities. The single POST method enables publishing to multiple social networks with built-in message scheduling and geo-location capabilities.

HTTP Method   Description
POST

Post messages to one or more social networks defined in a HootSuite account. This method provides access to the rich functionality available via the web dashboard, including scheduling, geo-location and posting to multiple networks.

Required Parameters:

  • message: The message to be posted across social networks
  • socialNetworks: An array of HootSuite social network IDs

Optional Parameters:

  • sendLater: Set to 1 to schedule the message to be sent later, otherwise, the message will be sent immediately
  • autoSchedule: Set to 1 to autoschedule the message to be sent later.
  • timestamp: An integer indicating the time the message is to be sent. Uses POSIX time format where the integer specified is the number of seconds since Thursday, January 1, 1970. All values will be rounded up to the nearest 5 minute time interval.
  • sendAlert: Set to 1 to trigger an email notification to the authenticated user's email address when the message is sent
  • replyToId: The ID of the tweet that is being responded to
  • lat: A latitude for geo-coding the message
  • long: A longitude for geo-coding the message
  • placeId: A Twitter place ID with which to associate the message
  • venueId: A Foursquare place ID with which to associate the message
  • privacyOptions: Only for Facebook and Linkedin. A node which keys are types of social networks and the values are nodes that have type, id, name and (optional) global keys. Example: 'privacyOptions': {'FACEBOOK': [{"type":"CUSTOM","id":123,"name":"Close Friends"}]}

Sample Response:

Sample Code

cURL

PHP Ruby
GET

Get messages for a social network by stream type.

Sort order is always reverse chronological, ie. newest first.

Messages from up to 5 streams can also be queried in one request by providing a "streams" array that contains a set of the below parameters for each stream as an array. By default, this will return one JSON object per stream; Using the "interleaved" parameter, you can retrieve messages from all requested streams in one merged result set, ordered reverse chronologically.
See examples below.

Note that the number of streams you can request from this endpoint is limited to 300 per hour (e.g. 300 requests for single streams, or 60 requests for 5 streams at a time).

Required Parameters:

  • socialNetworkId: HootSuite social network ID. The authenticated user needs to have access to it.
  • type: The type of stream:
    • Twitter:
      • HOME: Home feed
      • MENTION: Mentions
      • SENT: Sent messages
      • RETWEETS_OF_ME: Retweets by others of the tweets to this account
    • Facebook:
      • F_HOME_STREAM: Facebook home stream
      • F_WALL: Facebook wall
      • F_PHOTOS: Facebook photos
      • F_VIDEOS: Facebook videos
      • F_EVENTS: Facebook events
      • F_COMMENTS: Facebook comments

Optional Parameters:

  • count: Number of messages to return. Max: 30. Default: 30.
Optional Parameters for Twitter streams:
  • maxId: Return only messages with IDs lower than maxId (exclusive). Useful for pagination and infinite scrolling.
  • minId: Return only messages with IDs higher than minId (exclusive). Useful to check for new messages.
Optional Parameters for Facebook streams:
  • maxTimestamp: Return only messages with a "created" timestamp lower than maxTimestamp (exclusive). Useful for pagination and infinite scrolling.
  • minTimestamp: Return only messages with a "created" timestamp higher than minTimestamp (exclusive). Useful to check for new messages.

Notes:
  • min and max filters cannot be used together
  • minId and minTimestamp only have an effect if the result contains message IDs (Twitter) or timestamps (Facebook) that match or go below minId/minTimestamp before this filter is applied. A Twitter stream example of when providing minId has no effect would be: minId is the only optional filter you provide, and there are more than 30 messages that are more recent than minId => result gets trimmed to 30 before even reaching minId.
1. Sample response for simple request:

2. Sample request for multiple streams:

Returns:

An array of objects: One per stream, containing the requested socialNetworkId and type, and an array of the returned messages.

Sample Response:

3. Sample request for multiple streams, interleaved:

Returns:

An array of messages in the same format as with a simple request (see example above).

Sample Code

cURL

PHP Ruby

From the HootSuite Blog

Thumbnail for 8 Tips for Social Business, Part 6: Secure

8 Tips for Social Business, Part 6: Secure

Social media blunders make headlines, and these headlines make business executives nervous. We’ve all seen...
Read More

Thumbnail for Join us for Live Social Media Q&A with UK Minister, Vancouver Mayor

Join us for Live Social Media Q&A with UK Minister, Vancouver Mayor

A growing number of governments, from municipal to federal, are increasing their engagement through social...
Read More

Thumbnail for Big Global Social Networks Are Closing In On Facebook

Big Global Social Networks Are Closing In On Facebook

by Ryan Holmes, HootSuite CEO  Last year, Facebook marked a new milestone in its nine-year history. It...
Read More

Thumbnail for A Wiggly for Wednesday ~ Ultra Magnus

A Wiggly for Wednesday ~ Ultra Magnus

Ahhh, Wednesday again… which means another wonderful wiggly gif! HootSuite’s Greg Williams -aka gwilli- has thousands of these ‘wiggly’ images...
Read More