Tutorial: Post Images and Videos to Facebook & Twitter

 In CloudRail, Tutorial

In this tutorial you will learn how to post images, videos and text to Facebook, Twitter and Facebook Pages via the Unified Social API by CloudRail.
With CloudRail you can easily integrate external APIs into your application. CloudRail offers SDKs with abstracted interfaces that bundle several services to expose developer-friendly APIs that allow easy, native access to functionality independent of the underlying service. For example, this means that the upload() function to upload a file has the same signature for Dropbox as it does for Google Drive, OneDrive and other Cloud Storage Services. The same holds for the getEmail() function to get a user’s email address across all social networks and much more.

For quite a while we only supported posting messages to social networks. We recognized heavy traction so we decided to add the possibility to post images and videos as well. This feature is available for Twitter, Facebook and Facebook Pages.

Posting Images to Facebook and Twitter

The way how posting images works is quite simple. The method just takes a message that is posted along with the image and the image itself. However, all of the services have different restrictions concerning images. You should be fine if you only upload PNG, JPG or GIF images that are smaller than 3MB. For more information check out the documentation of Twitter and Facebook. Without further ado, let’s jump into an example:

Posting Videos to Facebook and Twitter

Posting videos requires some more parameters than posting images. In addition to message and the video content you also need to provide the size of the video as well as the MIME type. Any example for the latter would be video/mp4. The restrictions are less easy to break down, so we encourage you to take a look at the specifications by Twitter and Facebook again. Here is a sample illustrating the method:

Recent Posts