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.
Description of the
illustration youtube-to-socials.png
This recipe has the following integrations:
YouTube OCI Streaming YT Posts: This integration connects to your YouTube channel using REST APIs, gets all the playlists, fetches the metadata of videos (such as title, description, and URL), and posts videos to the OCI Streaming service as a JSON array.
Share YT Posts on Twitter: This integration polls all the messages from the OCI Streaming service, and shares them on Twitter.
Share YT Posts on LinkedIn: This integration polls all the messages from the OCI Steaming service, and shares them on LinkedIn.
The recipe has the following controls:
Exclude Playlist IDs: Use this control to exclude playlists from being shared on socials. Enter comma-separated IDs of the playlists that you want to exclude in the
exludePlaylistIds
key of the lookup table. See Configure the Lookup Table.Don’t share video posts on LinkedIn and Twitter: Use this control to prevent sharing posts on socials. For the following keys, set value to false to prevent sharing videos on LinkedIn and Twitter, respectively.
publishVideoOnLinkedIn
publishVideoOnTwitter
The default value for both the keys is true.
Share number of video posts on LinkedIn and Twitter: Use this control to specify the number of posts you want to share on LinkedIn and Twitter. You can configure this using the following keys in the lookup table.
noOfVideosToPublishOnLinkedIn
noOfVideosToPublishOnTwitter
The maximum possible value for the keys is 50, and the default value is 1.
System and Access Requirements
OCI Streaming
Compute Instance
Oracle Integration
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:
- Create API Key Credentials: See Create access credentials.
- Enable YouTube Data API v3: See Enabling and Disabling Services.
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.
On the Oracle Integration home page, scroll to the Accelerators & Recipes section.
Click Search All.
Find the recipe package that you want to install.
Select the package, and then click the Install icon.
After the package is installed, click the Configure 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
On the Configuration Editor page, select Oracle YT REST Connection.
Click Edit .
The connection configuration page appears.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. Click Save. If prompted, click Save for a second time.
Click Test to ensure that your connection is successfully configured.
A confirmation message is displayed if your test is successful.Click Back to return to the Configuration Editor page. Click Save again if prompted.
Configure the Oracle Twitter Connection
On the Configuration Editor page, select Oracle Twitter Connection.
Click Edit .
The connection configuration page appears.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. Click Save. If prompted, click Save for a second time.
Click Test to ensure that your connection is successfully configured.
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.
When complete, click Save.
Click Back 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.
On the Configuration Editor page, select Oracle LinkedIn Connection.
Click Edit .
The connection configuration page appears.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. Click Provide Consent. Prompts LinkedIn to ask consent of the user in order to authorize the application’s access to the LinkedIn profile.
Click Save. If prompted, click Save for a second time.
Click Test to ensure that your connection is successfully configured.
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.
When complete, click Save.
Click Back 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.
On the Configuration Editor page, select the lookup table, and click Edit .
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.
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.Run the recipe.
On the Configuration Editor page, select the integration flow and click Run .
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.
Monitor the execution of the integration flow in Oracle Integration.
On the Configuration Editor page, select the integration flow.
Click Run , then click Track Instances.
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.
Log in to your Twitter and LinkedIn instances and check for the new posts.
Related Documentation
- Using the Twitter Adapter with Oracle Integration
- Using the LinkedIn Adapter with Oracle Integration
- Using the REST Adapter with Oracle Integration
Share YouTube Video Posts on Socials
F69969-01
September 2022
Copyright © 2022, Oracle and/or its affiliates.
Primary Author: Oracle Corporation