YouTube Integration

YouTube is the world’s second-biggest search engine behind Google. People search for how-to videos, reviews, and to see products and services in action. By integrating YouTube with Sitecore Content Hub via webMethods.io there is a simplified method of uploading final and approved video content.

By integrating Sitecore Content Hub with YouTube via webMethods.io users can easily upload their video content to YouTube. This integration with YouTube reduces the bandwidth costs of streaming video content directly from the Cloud.


This connector is an illustrative example of a generic connector between Sitecore Content Hub and any external system (for example, YouTube). It aims to help developers better understand how to create their own custom connector.


This connector is for illustration purposes only. It will not be supported for all versions of Sitecore Content Hub.


webMethods.io are market leaders and recognized experts in integration with iPaaS, hybrid integration, APIs, B2B, cloud integration, and on-premises integration offerings.


In the following example, a Video asset will be uploaded to YouTube when the Type is modified to Social Media. Social Media is a user-created value for Type property.

Trigger configuration

Navigate to the Manage page and scroll down to Triggers:

Open the Triggers page which displays the Triggers Overview. On the Triggers Overview page, click on the button:

General settings

On the General tab of the new Trigger complete the form with the following details:

  • Name is a mandatory text field.

  • Description is an optional text field

  • Objective has three options on the entity event that the trigger will fire:

    • Entity creation
    • Entity modification
    • Entity deletion
  • Execution type:

    • In process
    • In background

    In this example, the trigger is to run In background:

Once the required details have been input click on the Conditions tab:



The Conditions tab requires that an entity definition is chosen to be used for the Trigger.

Click on the Add definition button:

Search for and select the required definition from the returned list. In this example, the needed definition is Asset (M.Asset):

Once the definition has been input, the condition or conditions can be set by clicking on the :

After clicking to add a condition:

  • Select the property of the entity to be the subject of the condition. In this example two conditions are created with the properties of Asset Media (AssetMediaToAsset) and Type (AssetTypeToAsset):

  • The value or state requires a choice from the dropdown menu of:

    In this example, current value is chosen for both conditions.

  • The available Clauses / Operators for the conditions are. In this example, both the conditions use the contains clause:

  • The subject of the condition is selectable from the values of the entity property. In this example the values of Mp4 for Asset media and Social Media for Type are selected.

Once the condition or conditions have been inserted, click on the Actions tab.


On the Actions tab, click on the Manage actions button:

On the new modal that lists the existing actions, click on the New action button:

A new modal form will open in which the details of the new action are to be input:

  • Name is a mandatory text field.
  • Label is an optional text field.
  • Action type is a drop down option with the following values:

    • Action script
    • API call
    • Azure Event Hub
    • Azure Service Bus
    • M Azure Service Bus
    • Print Entity Generation
    • Reporting channel
    • Start state machine

    As this is an integration with the YouTube API, the action type is API call:

Selecting the API call action type changes the form, with new fields shown:

  • Method with the choice of:

    • POST

    • PUT

    • GET

    In this example, the POST method is to be used.

  • API URL, the API required is found when creating a webhook in the webMethods.io workflow. This URL is available once a workflow has been created, and a webhook is covered in more detail in the next section.

  • Timeout can be set for the API call, after which the call fails if no response returns. The timeout values are expressed in seconds:

Input the required values for the new Action and then create the URL via the configuration of a webhook in webMethods.io:

webMethods configuration

By creating workflows in webMethods.io, Integration tasks can be automated.

Creating the first workflow

  1. Select or add a project via the

  2. Provide a name for the new project:

  3. To create the new workflow, click on the button.

  4. On the Workflow option, click on the button:

  5. On the workflow, click on the top of the start point of the workflow and select the settings icon:

  6. On the Trigger modal select the Webhook option:

  7. On the Webhook, use the copy icon to copy the URL.

  8. The complete process is as follows:

    Now return to the Action and paste in the URL copied from the Webhook.

    And proceed to save the new action via the button.

  9. The newly created Action can then be added to the Trigger using the Add action button located under Post actions:

  10. The Trigger can now be saved. Click on one of the ![save and save and close buttons] buttons.

  11. Before leaving the Trigger, activate the trigger:

The complete process of adding the Action and activating the Trigger is as follows:

The default headers of this action are subsequently pulled into the action.

Configuring Webhook

In this example, the Sitecore Content Hub entity modification triggers an action. i.e., an API call to webhook endpoint exposed by webMethods.io.

On the workflow, click on the top of the start point of the workflow and select the settings icon:

Activate the Webhook Payload:

In the Body of the Webhook payload, enter the payload. The most basic payload is:

{ "saveEntityMessage": { "TargetId": XXXXX} }

In this example: { "saveEntityMessage": { "TargetId": 13522} }

Where the value of the TargetId is the entity id of the asset to be uploaded:

Click on Next:

The payload is displayed. If correct, click on Done:

The complete configuration of the Webhook is as follows:

HTTP Request

webMethods requires additional information about the entity by making HTTP request to content hub. The URL of request is: {contentHubEndpoint}/api/entities/{TargetId}

​ e.g. https://sitecoreInstance.com/api/entities/11915

Sitecore Content Hub responds to this request by returning the entity details in JSON format, e.g., the EntityResponse.json.

The JSON file contains the relevant entity information required for download and storage i.e., URL and filename.

To create an HTTP Request, search for an HTTP Request component and pull this component into the workflow:

The new HTTP Request auto-links with the Webhook configuration created previously.

In the top left corner of the HTTP request component click on the settings icon :

A new modal opens which allows a custom name to be given to the HTTP Request:

On the next modal the Action of the HTTP Request can be configured with the Incoming Data from the Webhook:

Enter the URL of the Sitecore Content Hub instance into the URL field on the Action Configure side of the form:

On the Incoming Data side click on $request - Webhook field to extend this field and show the sub-values via the downward-pointing arrowhead:

Again on the Incoming Data side click on the body field to extend out thereby showing the sub-values via the downward-pointing arrowhead:

Underneath the extended body field extend SaveEntityMessage to show the TargetId. The TargetId is generated from the webhook:

Click on the TargetId and this target id is appended to the URL previously included in the Action Configure field:

On the Action Configure section click on the button underneath Headers field:

The values required for the Headers object are a Key-Value pair.

The Key is X-Auth-Token.

The Value is the API token generated in Sitecore Content Hub.

Token Value

Create a token for use in the HTTP Request, navigate to Users under Manage.

On the Superuser who is building the integration, click on the key icon.

Click the Create button to generate the API token and once the new Token is created, click on Copy token:

Once the Token has been inserted into the header, the HTTP Request process is complete:

The HTTP Request can then be tested to check that the values are correct. Click on the Test button and a statusCode is returned to show success or failure of the HTTP Request:


webMethods.io executes the Download File part of the workflow. The video file is downloaded using the URL extracted from the HTTP Request workflow component. The video file is saved locally in the webMethods.io workflow storage with filename retrieved from the HTTP Request response.

Search for a Download File component and drag this component in the workflow.

Once the component is included in the workflow, click on the Settings option in the top left corner .

A custom name can be entered, click on Next:

Click in the Add URL field and then extend the HTTP Request in the Incoming Data section to display the responseObject.

Extend the renditions field and then extend the downloadOriginal field before selecting the href to complete the Add URL field:

Once the URL has been added the scroll back to the properties object and select the filename incoming data into the File Name Action configuration:

Click on Next.

The Download File component can then be tested using the Test button:

Upload File

If the output includes the correct download original URL, the correct filename and the filepath (the video file is saved locally in the webMethods.io workflow storage with the filename extracted) then click on Done. The file downloaded from the Download file workflow component is now uploaded to YouTube. The file name and file path are extracted from the Download file workflow component output.

Upload requires OAuth tokens associated with the target YouTube account. They need to be obtained separately before configuring workflow in webMethods.io. More details can be found at https://developers.google.com/identity/protocols/OAuth2WebServer.

Search for a YouTube component and drag this component into the webMethods.io workflow:

Once the YouTube component has been included in the workflow, select the Settings option on the component .

On the new modal, click on the displayed at the end of the Authorize YouTube field to display the fields to define the YouTube account details:

Complete the forms with the details from the Google API account and the required Access and Refresh tokens described at https://developers.google.com/identity/protocols/OAuth2WebServer.

The Refresh URL to be used is https://www.webmethods.io.

The Grant Type is authorization_code.

Once the details have been inserted click on Save:

On the new modal extend the Download File in the Incoming Data section:

  • Link the filepath to the Source File Path field in the Action Configure section.

  • Link the filename to the Title field in the Action Configure section.

  • Link the filename to the Description field in the Action Configure section.

Once complete, click on Next.

The configuration of the YouTube component can then be tested.

If the Output is satisfactory click on Done:

Once the YouTube component has been saved, it can be joined to the :

In this example, the video Asset is modified to include the Type of Social Media in Sitecore Content Hub. This modification fires the Trigger in Sitecore Content Hub, which activates the Webhook in webMethods.io workflow. The workflow downloads the video from Sitecore Content Hub and uploads the video to YouTube.


Metadata fields inside Sitecore Content Hub can be be used for YouTube’s Title, Description, and Tags fields, enabling users to provide the SEO-optimized content they need to make sure their videos are found.

Can we improve this article ? Provide feedback