Share YouTube Video Posts on Socials

Share YouTube Video Posts on Socials

Use this recipe to connect to your YouTube channel, get the metadata of videos (such as title, description, and URL), and post the videos on LinkedIn and Twitter.

Note: This recipe is available as YouTube — Socials | Share Video Posts in the Integration Store. Oracle provides this recipe as a sample only. The recipe is meant only for guidance, and is not warranted to be error-free. No support is provided for this recipe.

Overview

The recipe demonstrates how to connect to your YouTube channel, get all the playlists, fetch the metadata of videos (such as title, description, and URL), and post the videos to the OCI Streaming service as a JSON.

Two independent app-driven orchestration flows poll the OCI Streaming service, retrieve the JSON data, and share it on LinkedIn and Twitter, respectively.

Note: Each time the app-driven integrations poll the video post from OCI Streaming, a random video post is shared on the socials. A random integer is generated to obtain video postings from an array queried from the OCI Streaming service. For instance, if there are thirty videos in a playlist, a random number between 1 and 30 is generated using the JavaScript library, and based on that random number, the video post is fetched from the playlist array and posted on socials.

In this recipe, we use the OCI Streaming service to publish all the playlist video posts as a JSON, and two subscribers are connected to the same stream to consume the video posts.

Recipe Schema

This section provides an architectural overview of the recipe.

youtube-to-socials
Description of the illustration youtube-to-socials.png

This recipe has the following integrations:

The recipe has the following controls:

System and Access Requirements

Before You Install the Recipe

You must perform the following configuration tasks on your OCI, Twitter, and LinkedIn instances in order to successfully connect to these external systems using Oracle Integration and share posts on socials.

Create OCI Compute Instance

Create a compute instance to install the Oracle Integration agent. See Create a Compute Instance.

Install Oracle Integration Agent on Compute Instance

Download and install the Oracle Integration agent in the compute instance you created.

Note: Before you install the Oracle Integration agent, ensure that you create an Agent group. Refer to the same group in the OCI Streaming connection.

See Agent Download and Installation.

Create OCI Stream

Create an OCI Stream named YTPostStream. The stream must have a single-partition which is used to retrieve video-related metadata as JSON. For this recipe, we have created a default stream pool as a public endpoint. See Creating Streams.

Note: You can choose to create a new stream pool with a private endpoint. While doing so, ensure that the Oracle Integration agent is able to connect to your stream pool.

Create a Twitter Application

Create a Twitter application to get access to the Twitter API, which is then used to configure the Twitter adapter. See Prerequisites for Creating a Connection in Using the Twitter Adapter with Oracle Integration.

Create a LinkedIn Application

Register an application in the LinkedIn developer console to obtain client ID and client secret, which is then used to configure the LinkedIn adapter. See Prerequisites for Creating a Connection in Using the LinkedIn Adapter with Oracle Integration.

Create a Project in Google Cloud

Create a project in Google Cloud to connect to the YouTube APIs. See Creating and managing projects.

After creating the project, you must:

You’ll use this API key in the REST adapter configuration.

Install and Configure the Recipe

On your Oracle Integration instance, install the recipe package to deploy and configure the integration and associated resources.

  1. On the Oracle Integration home page, scroll to the Accelerators & Recipes section.

  2. Click Search All.

  3. Find the recipe package that you want to install.

  4. Select the package, and then click the Install Install icon icon.

  5. After the package is installed, click the Configure Configure icon icon on the recipe card to configure the resources deployed by the package.

    The Configuration Editor page opens, displaying all the resources of the recipe package. Configure the following resources before you activate and run the recipe.

Configure the Oracle YT REST Connection

  1. On the Configuration Editor page, select Oracle YT REST Connection.

  2. Click Edit Edit icon.
    The connection configuration page appears.

  3. In the Security section, enter the following details.

    Field Information to Enter
    Security Policy Select API Key Based Authentication .
    API Key Enter the Google API Key which you created in the Create a Project in Google Cloud section.
  4. Click Save. If prompted, click Save for a second time.

  5. Click Test to ensure that your connection is successfully configured.
    A confirmation message is displayed if your test is successful.

  6. Click Back Back icon to return to the Configuration Editor page. Click Save again if prompted.

Configure the Oracle Twitter Connection

  1. On the Configuration Editor page, select Oracle Twitter Connection.

  2. Click Edit Edit icon.
    The connection configuration page appears.

  3. In the Security section, enter the following details.

    Field Information to Enter
    Security Policy Leave Custom Security Policy selected.
    Consumer Key Enter the consumer key.
    Consumer Secret Enter the consumer secret.
    Access Token Enter the access token.
    Access Secret Enter the access token secret.
  4. Click Save. If prompted, click Save for a second time.

  5. Click Test to ensure that your connection is successfully configured.

  6. Wait for a message about the results of the connection test.

    • If the test was successful, then the connection is configured properly.
    • If the test failed, then edit the configuration details you entered. Check for typos, verify URLs and credentials, and download the diagnostic logs for additional details. Continue to test until the connection is successful.
  7. When complete, click Save.

  8. Click Back Back icon to return to the Configuration Editor page. Click Save again if prompted.

Configure the Oracle LinkedIn Connection

This connection is used to share the video posts on LinkedIn.

  1. On the Configuration Editor page, select Oracle LinkedIn Connection.

  2. Click Edit Edit icon.
    The connection configuration page appears.

  3. In the Security section, enter the following details.

    Field Information to Enter
    Client ID Enter the unique string provided to your client on the LinkedIn developer console.
    Client Secret Enter the client secret.
    Scope Enter the scope of the access request. Scopes enable you to specify which type of access you need, for example: r_basicprofile+r_emailaddress+w_share.
  4. Click Provide Consent. Prompts LinkedIn to ask consent of the user in order to authorize the application’s access to the LinkedIn profile.

  5. Click Save. If prompted, click Save for a second time.

  6. Click Test to ensure that your connection is successfully configured.

  7. Wait for a message about the results of the connection test.

    • If the test was successful, then the connection is configured properly.
    • If the test failed, then edit the configuration details you entered. Check for typos, verify URLs and credentials, and download the diagnostic logs for additional details. Continue to test until the connection is successful.
  8. When complete, click Save.

  9. Click Back Back icon to return to the Configuration Editor page. Click Save again if prompted.

Configure the Lookup Table

Edit the Oracle_Share_YT_Posts_On_Socials lookup table to maintain the configurable values.

  1. On the Configuration Editor page, select the lookup table, and click Edit Edit icon.

  2. Enter the following information.

    Key Description
    channelId Enter the ID of the YouTube channel from which you want to fetch video posts.
    linkedInOwnerId Enter the LinkedIn owner ID.
    exludePlaylistIds Enter comma-separated playlist IDs that you want to exclude.
    exludePlaylistNamesForIdentification(Not in use) Enter comma-separated playlist names that you want to exclude for reference. This variable is not used in any integration.
    publishVideoOnLinkedIn Set false if you don’t want to share posts on LinkedIn. Default value is true.
    publishVideoOnTwitter Set false if you don’t want to share posts on Twitter. Default value is true.
    tags Configure the tags that you want to attach with your Twitter posts.
    noOfVideosToPublishOnLinkedIn Update this number if you want to share more than one video on LinkedIn in a single post. Default value is 1. The maximum possible value is 50.
    noOfVideosToPublishOnTwitter Update this number if you want to share more than one video on Twitter in a single post. Default value is 1. The maximum possible value is 50.
    emailTo Enter the email ID on which you want to receive email notifications in case of any errors in the recipe.
    emailFrom Enter the email ID from which you want to send email notifications in case of any errors in the recipe.

Activate and Run the Recipe

After you’ve configured the connections and the lookup table, activate the recipe package and run it.

  1. On the Configuration Editor page, click Activate in the title bar. In the Activate Package dialog, click Activate again.
    A confirmation message is displayed informing that the integration has been submitted for activation. Refresh the page to view the updated status of the integration.

  2. Run the recipe.

    1. On the Configuration Editor page, select the integration flow and click Run Run icon.

    2. Click Submit Now.
      You’ve now successfully submitted the integration for execution.

      Note: You can also schedule this integration to run at a date, time, and frequency of your choosing. See Define the Integration Schedule.

  3. Monitor the execution of the integration flow in Oracle Integration.

    1. On the Configuration Editor page, select the integration flow.

    2. Click Run Run icon, then click Track Instances.

    3. On the Track Instances page, you’ll see the integration flow of the recipe being triggered and executing successfully.
      The recipe now shares YouTube video posts on socials.

  4. Log in to your Twitter and LinkedIn instances and check for the new posts.

Related Documentation