Social embed plugin

Digital Writer default Social embed plugin with support for Twitter, Facebook, Instagram, Vimeo and Soundcloud

This is handled by the writer it self, that's why the configuration for appId and disabling is placed directly in
the writer configuration.

Plugin configuration

To install the plugin, add the following configuration.

{
    "id": "io.infomaker.socialembed",
    "name": "im-socialembed",
    "url": "https://plugins.writer.infomaker.io/v1/infomaker/im-socialembed/{PLUGIN_VERSION}/index.js",
    "style": "https://plugins.writer.infomaker.io/v1/infomaker/im-socialembed/{PLUGIN_VERSION}/style.css",
    "enabled": true,
    "mandatory": false,
    "data": {
        "alternateTwitterTitle": "{author_name} wrote on twitter",
        "alternateInstagramTitle": "{author_name} posted on Instagram. {text}",
        "alternateFacebookTitle": "{author_name} posted on Facebook",
        "alternateDefaultTitle": "{author_name} posted on {provider_name}",
        "region":"eu-west-1",
        "environment":"stage"
    }
}

Basic options

Property Type Required Description
alternateTwitterTitle String false Alternative Twitter title. {author_name} is available as a string variable that will be replaced with the actual author name.
alternateInstagramTitle String false Alternative Instagram title. {author_name} is available as a string variable that will be replaced with the actual author name.
alternateFacebookTitle String false Alternative Facebook title. {author_name} is available as a string variable that will be replaced with the actual author name.
alternateDefaultTitle String false Alternative default title. {author_name} is available as a string variable that will be replaced with the actual author name.
region String "eu-west-1" Region name where the backend API is deployed
environment String "stage" Backend API environment

Generic properties

This plugin supports Generic properties, for configuration see the writer documentation

Disable loading of external libraries

Loading external libraries can be disabled using: disableExternalSocialEmbeds at a top level the in writer configuration file.

{
  "newsItemTemplateId": "30eae1c0-c640-4053-b114-05c64e28bbe7",
  "language": "sv_SE",
  "languageFallbacks": {
    "sv": "sv_SE",
    "en": "en_US"
  },
  "labelLanguage": "sv",
  "disableExternalSocialEmbeds": true
  ...

Enable instagram and facebook embeds

To embed instagram or facebook posts a number of requirements need to be fulfilled. First of all a facebook app must exist. See below links with more details. Secondly the facebookAppId and facebookClientToken are required at the top level in in writer configuration file.

These keys can be retrieved by creating an app at Facebook. https://developers.facebook.com/apps/

Read more on requirements and setup of instagram and facebook embedding here:

{
  "newsItemTemplateId": "30eae1c0-c640-4053-b114-05c64e28bbe7",
  "language": "sv_SE",
  "languageFallbacks": {
    "sv": "sv_SE",
    "en": "en_US"
  },
  "labelLanguage": "sv",
  "showTextStyles": true,
  "forcePlaintextPaste": true,
  "facebookAppId": "1234...",
  "facebookClientToken": "1234......"
  ...

Alternate links is created for every social embed object.

There is more information about alternate links at Writer-format at Github

Following variables could/should be defined in Writer Config.

{author_name} is available as a string variable that will be replaced with the actual author name.

Example

"data": {
  "alternateTwitterTitle": "{author_name} tweeted",
  "alternateFacebookTitle": "{author_name} posted on Facebook"
}

Output

In the article, the plugin will add the following xml block under newsItem > contentSet > inlineXML > idf > group:

Facebook

Post

<object id="socialembed-f5da770b839dc92b2bcfae54c804ae97" type="x-im/socialembed">
    <links>
        <link rel="self" type="x-im/facebook-post" url="https://www.facebook.com/stotenisalen/posts/10158053045049843" uri="im://facebook-post/10158053045049843"/>
        <link rel="alternate" type="text/html" url="https://www.facebook.com/stotenisalen/posts/10158053045049843" title="Stöten i Sälen postade på Facebook">
            <data>
                <context>Social</context>
                <provider>Facebook</provider>
            </data>
        </link>
    </links>
</object>

Page

<object id="socialembed-221465e03d2a77f0836b85ee62851504" type="x-im/socialembed">
    <links>
        <link rel="self" type="x-im/facebook-page" url="https://www.facebook.com/infomakerscandinavia" uri="im://facebook-page/infomakerscandinavia"/>
        <link rel="alternate" type="text/html" url="https://www.facebook.com/infomakerscandinavia" title="infomakerscandinavia">
            <data>
                <context>Social</context>
                <provider>Facebook</provider>
            </data>
        </link>
    </links>
</object>

Video

<object id="socialembed-0c2a57aa637e696ba4b2eb99c3b3e022" type="x-im/socialembed">
    <links>
        <link rel="self" type="x-im/facebook-video" url="https://www.facebook.com/130004133621/videos/870816339922635/" uri="im://facebook-video/870816339922635"/>
        <link rel="alternate" type="text/html" url="https://www.facebook.com/130004133621/videos/870816339922635/" title="Naviga Content Lab postade på Facebook">
            <data>
                <context>Social</context>
                <provider>Facebook</provider>
            </data>
        </link>
    </links>
</object>

Twitter

<object id="socialembed-4c4cfaef42e8cf621190fc66e8089d58" type="x-im/socialembed">
    <links>
        <link rel="self" type="x-im/tweet" url="https://twitter.com/infomakernews/status/910422014271348736" uri="im://tweet/910422014271348736"/>
        <link rel="alternate" type="text/html" url="https://twitter.com/infomakernews/status/910422014271348736" title="Infomaker skrev på Twitter"/>
    </links>
</object>

Vimeo

<object id="socialembed-6d732e68f08c1022d90c9c45d6affd3e" type="x-im/socialembed">
    <links>
        <link rel="self" type="x-im/vimeo" url="https://vimeo.com/76979871" uri="im://vimeo/76979871"/>
        <link rel="alternate" type="text/html" url="https://vimeo.com/76979871" title="Vimeo Staff postade på Vimeo">
            <data>
                <context>Social</context>
                <provider>Vimeo</provider>
            </data>
        </link>
    </links>
</object>

Instagram

<object id="socialembed-39860e0d53babce67db7f8a49daf4056" type="x-im/socialembed">
    <links>
        <link rel="self" type="x-im/instagram" url="https://www.instagram.com/p/zvV3xmOvb3/" uri="im://instagram/undefined"/>
        <link rel="alternate" type="text/html" url="https://www.instagram.com/p/zvV3xmOvb3/" title="infomakernews postade en bild på Instagram. ">
            <data>
                <context>Social</context>
                <provider>Instagram</provider>
            </data>
        </link>
        <link rel="alternate" type="image/jpg" url="https://scontent.cdninstagram.com/v/t51.2885-15/e15/11008312_1453406918282922_220940562_n.jpg?_nc_ht=scontent.cdninstagram.com&amp;_nc_cat=106&amp;_nc_ohc=CdLhB86ea28AX_BYyPo&amp;tp=18&amp;oh=d8e2888b5909e81fbe56daf887f066de&amp;oe=5FDBAACD">
            <data>
                <width>640</width>
                <height>640</height>
            </data>
        </link>
    </links>
</object>

Soundcloud

<object id="socialembed-5a61d839cd956b1d511e2272b9d62c10" type="x-im/socialembed">
    <links>
        <link rel="self" type="x-im/soundcloud" url="https://soundcloud.com/angrysausage/toby-fox-undertale" uri="im://soundcloud/angrysausage.Toby%20Fox%20-%20UNDERTALE%20Soundtrack%20-%20100%20MEGALOVANIA%20by%20angrysausage"/>
        <link rel="alternate" type="text/html" url="https://soundcloud.com/angrysausage/toby-fox-undertale" title="angrysausage postade på SoundCloud">
            <data>
                <context>Social</context>
                <provider>SoundCloud</provider>
            </data>
        </link>
    </links>
</object>