SDK Sample app for external developers to install
Table of Contents
- Getting started
- Other things you can do with the Plugin SDK
- Useful Links
What is the Hootsuite dashboard?
The Hootsuite dashboard is a tool which allows you to manage all of your social media in one place.
What does a Hootsuite app do?
What does this Hootsuite app do?
This Sample App currently only contains a sample plugin component (allows users to send things from Hootsuite streams to an app) and a sample stream component. The plugin listens for a
'sendtoapp' event and opens a modal, populated with the data from the message it was activated on. The stream displays some sample messages and has buttons that activate SDK functions. Components in a Hootsuite app are largely seperate but it is possible to communicate between them.
The Sample App can be hosted locally, or on Heroku or some other hosting service. The backend is a very simple NodeJS/Express app but you can swap out the backend with anything as long as you meet a few requirements. These are listed below in the Using another hosting solution section.
- Setup Heroku.
- Clone this repository.
git clone https://github.com/HootsuiteApps/sdk-sample.git
- Create a Heroku app for this sample app.
- Configure Twitter (Optional):
heroku plugins:install heroku-configto install heroku-config plugin
- rename .env-example to .env
- open .env to fill in the fields with your Twitter keys and access tokens.
heroku config:pushto write the contents of .env to heroku config
git push heroku masterto push this app to Heroku. Heroku should detect that this app is a Node/Express app and run your index.js file
- Once Heroku says that it's done use
heroku openand add /modal to the URL it opened in your browser. If it comes up with a blank page that has a "Show JSON Payload" button then the web server is setup correctly.
Configuring your Hootsuite App
- If you already have a Hootsuite developer account head over to your Hootsuite app directory management page and create an app, and inside that app create a plugin component.
- Edit the plugin component and enter the following into the fields: For the plugin component Service URL use your endpoint for plugin.html, if you used Heroku and Node this would be
https://<heroku-app-name-here>.herokuapp.com/plugin. Also, check off the Default Install box.
- If you'd like to install a stream example as well you should create another component, but this time make it a stream. Edit it again and this time enter
https://<heroku-app-name-here>.herokuapp.com/streamas your Service URL.
- Install your app by going to your Hootsuite dashboard and navigating to the app directory (puzzle piece at the bottom of the left sidebar). Your app should be under Developer, install it.
- Test it by going to your Hootsuite dashboard, clicking the elipsis on any post and hitting Send to . This should pop up a modal with some info about the post you sent to the app.
Configuring your shared secret (for use with attachFileToMessage())
- Edit your app in My Apps
- Under "Authentication Type" select "Single Sign-On (SHA-512)"
- Create a shared secret (preferably by randomly generating it) and enter it into the "Shared Secret" field and hit save at the bottom of the page.
- Paste the Shared Secret into .env, run
heroku config:pushand you should be good to go!
Configuring your Google client ID
- Access the Google Cloud Console and create a project.
- Go to
- Copy your OAuth 2 Client ID and paste it into
stream.htmlwhere it says
Using another hosting solution
You can host your app on any service, but here are few things to keep in mind:
- You need to accept POST requests on your plugin and stream endpoints.
- Your endpoints need to have HTTPS.
Other things you can do with the Plugin SDK
- Use it to send a post to your own servers and manipulate/save it.
- Process the images from a post and use the attachFileToMessage SDK function to put the processed images into the compose box.
- Compose messages using the composeMessage SDK function based on the contents of a message that was sent to your plugin.