Skip to main content
Skip table of contents

Install Social Media service

The Social Media service is required to publish content from censhare to social networks (Twitter, Facebook, YouTube). The service connects to the social media apps via the respective APIs.

Prerequisites

  • JDK 11.0.6 or higher must be installed on the host machine.

  • As entry point, a proxy such as HAProxy must be installed. Usually, this is part of the censhare RPM package.

  • Developer accounts for each social network.

  • A Social media application for each social network. For a quick reference see the Create censhare social media applications below.

Introduction

The Social Media service is required to publish content from censhare to a social network. The Social Media service connects to the APIs of the social networks, authenticates the user, and publishes the desired content to the selected profile. From the social networks, the Social media service retrieves reactions to the posts. These reactions are displayed in the corresponding social media post assets in censhare.

To use the Social media service in censhare, you must create and configure the respective application in each social network to which you want to publish. This is done in the developer area of the social network.

The Social media service can be installed on the same host as the censhare Server, or on a dedicated host.

Create social media applications

Before you can set up the Social media service in censhare, you must register your censhare application in each Social network to which you want to publish content. The registration is done in the developer area of the respective network.


As operator of the censhare platform, you are held responsible towards the operator of the Social network for the conformity of your application as well as content published through the application with their respective terms and conditions.

The registration process, terms and conditions, as well as the published/retrieved data are subject to change.


Facebook

Note: You can only publish content to a Facebook page. Before you create your app, you need a Facebook page to which your content is published. Posts on a user timeline are not allowed.

  1. Go to https://developers.facebook.com/apps and create an app with the following Settings:

    Settings - Basic

    Value

    Description

    App ID

    generated automatically

    You need this value for the configuration of the Social media service.

    App Secret

    generated automatically

    You need this value for the configuration of the Social media service.

    Display name

    [YOUR_APP]

    This value displays as publisher of a post: "Published by [YOUR_APP]"

    Contact Email

    [YOUR_EMAIL]

    Enter a valid e-mail address.

    Settings - Advanced



    Upgrade API Version

    v7.0

    Make sure to use API v7.0 for both settings.

  2. Add Facebook Login product with the following settings:

    Client OAuth Settings

    Value

    Description

    Client OAuth Login

    Yes

    Enables the token flow. See also the Valid OAuth redirect URIs setting below.

    Web OAuth Login

    Yes

    Required to log in from censhare Web.

    Valid OAuth Redirect URIs

    https://[YOUR_DOMAIN]/signin/facebook

    The /signin context path must be configured as passing request entry in the proxy configuration.

  3. To connect from censhare Web to your app, the respective permissions must be requested and approved by Facebook. To request permissions and initiate the review process, click Requests in the left menu and add the following permissions:

    Permissions and Features

    Action

    Description

    pages_manage_posts

    request

    These are the minimal required permissions. Other permissions can be requested, if desired.

    pages_read_engagement

    request

  4. Copy or note the APP ID and the APP Secret. You need the values to configure the censhare Social Media Service. To display the APP Secret as plain text, Facebook asks you to enter your credentials.

Twitter

  1. Got to https://apps.twitter.com, register as developer and create a new app with the following parameters:

    App details

    Value

    Description

    Website URL

    https://[YOUR_DOMAIN]/

    To create an app, register as developer and add a new app in your personal account.

    App Name

    [YOUR_APPLICATION]

    The app name does not display in the tweet.

    Callback URL

    [YOUR_DOMAIN]/signin/twitter

    The URL handles the authentication and must be accessible externally.

  2. Go to the Permissions tab and set the following permissions:

    Permissions

    Value

    Access permissions

    Read and Write

  3. Go to the Key and tokens tab and copy the following parameters. You need these to configure the censhare Social media service:

    • API key

    • API secret key

YouTube

YouTube is part of the Google universe. To create a YouTube app, log in to the Google developer console. In Google, apps are called projects. This section takes you through the setup and registration process for your app.

Important note: YouTube offers quotas for API requests. By default, an app gets a free quota of 10,000 points per day. Uploading a video via your app costs 1600 points. Other API requests have their respective quotas. For more information, see the YouTube API Quota Calculator.

  1. Go to https://console.developers.google.com/apis/credentials and create a new project with the following parameters:

    Project info

    Value

    Description

    Project name

    [YOUR_APP_NAME]

    The name cannot be changed later.

    Project ID

    [YOUR_APP_ID]

    You can use the same ID as the name, or enter a different ID. The ID cannot be changed later.

    Project number

    generated automatically


  2. After you have created your project, the project dashboard displays. In the APIs widget, click Go to APIs overview, and then ENABLE APIS AND SERVICES.

  3. Select YouTube Data API v3 and click Enable.

  4. Click CREATE CREDENTIALS and set the following parameters:

    Add credentials

    Value

    Which API are you using?

    YouTube Data API v3

    Where will you be calling the API from?

    Web server

    What data will you be accessing?

    User data

  5. Click What credentials do I need? and in the dialog, click SET UP CONSENT SCREEN. The configuration dialog opens in a new tab. Do not close the Add credentials to your project dialog. You need to complete this configuration later.

  6. Click CREATE and set up the OAuth consent screen as follows:

    Note: If you use G-Suite, we recommend to select the user type Internal. This makes the app registration process easier, as internal apps do not require review by Google.

    OAuth consent screen

    Value

    Description

    Application name

    [YOUR_APP]

    Enter the name of your censhare platform.

    Application logo

    [YOUR_LOGO]

    Add an optional logo that is shown in your app.

    Support email

    selected automatically

    If you have registered multiple emails, you can select the desired address.

    Scopes for Google APIs

    email

    Default. This value is preselected and cannot be changed.


    profile

    Default. This value is preselected and cannot be changed.


    openid

    Default. This value is preselected and cannot be changed.

    Add scope - Click and enable the following scopes, then click ADD to save:



    ../auth/youtube.force-ssl

    enable


    ../auth/youtube.upload

    enable


    Authorized domains

    [YOUR_CENSHARE_WEB_DOMAIN]

    We recommend that you always enter an authorized domain to ensure that the app can only be accessed from your censhare Web domain.

  7. Go back to the Credentials dialog and complete the configuration as follows:

    Add credentials to your project

    Value

    Description

    Name

    [YOUR_CLIENT]

    Enter a client name.

    Authorized redirect URIs

    https://[YOUR_DOMAIN]/signin/google

    After successful authorization, the Google server redirects to this URL. The URL must be accessible externally.

  8. Click Create OAuth client ID. If the button does not display at the bottom of the page, click Refresh first.

  9. Click Download to save your credentials to your computer in a JSON file. From this file, you need the client_id and the client_secret values to configure the proxy of the Social media service.

Configure the reverse proxy

The authentication and communication between the censhare Server, the Social media service, and the social networks APIs require a reverse proxy for the censhare Server. The reverse proxy must be accessible from external locations and requires a valid SSL certificate.

censhare is delivered with NGINX as default reverse proxy. Any other proxy such as Apache, HAProxy or LB5 can be used.

Following, we provide the parameters that must be added to the configuration of NGINX. If you are using a different reverse proxy in your censhare environment, configure the proxy accordingly:

  1. On the host of the proxy service, go to the location of the configuration file. The default location for the NGINX configuration is /etc/nginx/nginx.conf.

  2. Open the configuration file in an external editor, and add the following lines:

    CODE
    # SOCIAL MICRO-SERVICE: BEGIN
       location /connect/ {
          proxy_pass http://localhost:7056;
       }
       location /signin/ {
          proxy_pass http://localhost:7056;
       }
       location /api/social/ {
          proxy_pass http://localhost:7056;
       }
       # optional for debugging
       # location /h2-console/ {
       #   proxy pass http://localhost:7056;
       # }
    # SOCIAL MICRO-SERVICE: END
  3. Save your changes and restart the proxy.

Install the Social media service

The Social media service can be installed on the same host as the censhare Server, or any other host. The Social media service is provided as RPM package. It runs with censhare Web and censhare WP.

To install the service, proceed as follows:

  1. Add the repository and install the package as described in Install and configure censhare WP. The package is part of the censhare Server repository.

  2. Run the installation command:

    CODE
    yum install censhare-social-media-service

    The installation creates the /opt/censer/social-media directory on the host server with the following content:

    • social-media.jar - executable JAR to run the Social media service.

    • application.yml - configuration file for the Social medial service.

  3. Go to the social-media directory and create the db and dump subdirectories:

    CODE
    cd /opt/censer/social-media
    mkdir db
    mkdir dump

  4. Open the application.yml file and configure the service as follows:

    Parameter

    Value

    Comment

    server.port

    7056

    To use another port, change the default value to the desired port.

    client.spring-social-customizer.connect-
    controller-application-url

    [CENSHARE_BASE_URL]


    client.spring-social-customizer.sign-in-controller-application-url

    [CENSHARE_BASE_URL]


    client.spring-social-customizer.sign-in-controller-sign-up-url

    /api/social/signup

    To pass requests, the /api/social path must be added in the proxy configuration.

    spring.h2.console.enabled

    false

    Only enable for testing and development purposes. In production environments must be set to false.

    censhare.microservices.standalone-web-server.host

    [CENSHARE_BASE_URL]

    Enter the base URL of your censhare instance.

    censhare.microservices.standalone-web-server.username

    [USER_NAME]

    Enter the system user to access the REST API of the censhare Server. Ensure that the system user has access to domains in which the published content (images, videos) is located. For example, the Media domain of the censhare Dedicated solutions.

    censhare.microservices.standalone-web-server.password

    [PASSWORD]

    Enter the password of the system user to access the REST API of the censhare Server. (1)

    censhare.microservices.standalone-web-server.timeout-ms

    5000

    Timeout limit in milliseconds. If necessary, change the value.

    censhare.microservices.standalone-web-server.temp-download-folder

    [DIRECTORY_NAME]

    Create a directory for temporary storage item downloads from censhare. Default directory is dump.

    client.access-control-allow-origins

    [CENSHARE_BASE_URL], ...

    Enter a comma separated list of hosts that can connect to the Social media service. The host of your censhare instance must be part of the list. Other hosts are optional.

    client.signup-info-redirect-url

    /

    If you use a proxy service (for example: NGINX), redirect to the root directory.

    client.signin-context

    /signin/

    If you change this value, you must change the callback/redirect URLs in your social media applications accordingly.

    spring.social.facebook.app-id

    ${CS_SOC_FACEBOOK_APP_ID}

    Enter the IDs and secrets of each social media app here. If you do not want to use a social media app, enter dummy values for the respective ID and secret. Alternatively, you can declare these as environment variables in an .env file. In this case, leave the placeholders as is.

    spring.social.facebook.app-secret

    ${CS_SOC_FACEBOOK_APP_SECRET}

    spring.social.twitter.app-id

    ${CS_SOC_TWITTER_APP_ID}

    spring.social.twitter.app-secret

    ${CS_SOC_TWITTER_APP_SECRET}

    spring.social.linkedin.app-id

    ${CS_SOC_LINKEDIN_APP_ID}

    spring.social.linkedin.app-secret

    ${CS_SOC_LINKEDIN_APP_SECRET}

    spring.social.youtube.app-id

    ${CS_SOC_GOOGLE_APP_ID}

    spring.social.youtube.app-secret

    ${CS_SOC_GOOGLE_APP_SECRET}

    logging.level.org.apache.http.client.protocol.ResponseProcessCookies

    ERROR

    Determines the level of details written into the log files.

    logging.level.org.springframework.social.google

    INFO


    logging.level.com.censhare

    INFO


  5. To start the service, execute the following command:

    systemctl start censhare-social-media

    If the server is already running, use the restart parameter. To stop the server use the stop parameter

Result

The Social Media service is running in the censhare environment. This is a prerequisite to use authenticate at the social media apps from censhare Web, and to publish content through the Social Media Publishing wizard.

Next steps

Configure social Networks module

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.