Configuring automatic posting to Facebook or Twitter

From Kentico, you can post messages to Facebook and Twitter directly from the Pages application or the on-site editing interface.

You have the following options how to publish content from within the editing interface to Facebook or Twitter. Each of them is suitable for a different situation.

In both these cases, you post to the chosen social media from within the interface where you edit a document. You can use macros in the post, for example, to insert the URL of the document into the post.

Publishing to Facebook or Twitter using a workflow step

You can post messages to social media as part of a document’s workflow process using the Publish to Facebook and Publish to Twitter workflow steps. You can use this approach to automatically publish information about documents in a section of your site’s content.

If you want to write a message and publish it to social media directly from the document editing interface, consider Publishing to Facebook or Twitter using form controls.

  1. Connect Kentico to the social media and Add a social media account.

  2. Edit the social media account that you want to publish to.

  3. Enable the Default check box and save the social media account.

    • The Default check box designates the account as the account that advanced workflow should use. You can have only one default account per one social media.
  4. Create an advanced workflow with the Publish to Facebook or Publish to Twitter step.

    Publishing to Twitter using advanced workflow

  5.  Set the Text of the message which will be automatically posted to Facebook/Twitter in the Workflow step properties. You can use macros in the message.

    • For example, Check out our new blog post at www.example.com{% GetDocumentURL() %}. The resulting URL could then look like this: www.example.com/blog/my-latest-blog-post.aspx
  6. Create a document using this defined workflow.

When advancing over the Publish to Facebook/Publish to Twitter step in the workflow, the predefined message will be automatically posted. The message will appear in Kentico in the Facebook or Twitter application.

Using macros in tweet text

If you use macros in the Text property of the Publish to Twitter text, the remaining character counter reflects the length of the macro string, not the length of the resulting text.

Use the LimitLength macro to ensure the result of other macros doesn’t exceed the tweet character limit.

Syntax: String LimitLength (String text, Int32 length)

Example: {% LimitLength(DocumentName, 20) %} - inserts the name of the current document but limits the length to 20 characters.

Publishing to Facebook or Twitter using form controls

By adding the Facebook auto post and Twitter auto post form controls to a document type, you can enable editors to post messages to social media from the document editing interface.

You can see an example of the setup in the default Blog post document type, which integrates both Facebook and Twitter posting controls. However, you still need to perform step 1 of the following procedure.

  1. Connect Kentico to the social media and Add a social media account.
  2. Open the Document types application.
  3. Edit () the chosen document type.
  4. On the Fields tab, click New field.
  5. Set up the following properties:
    • Field name
    • Field type: Long text
    • Field caption
    • Form control: Facebook auto post or Twitter auto post
  6. Click Save.

When you edit a document of the modified type in the Pages application, a new field appears on the Form tab. The field allows editors to compose a message to be posted on social media.

Posting to Facebook from the Pages application

When the editor saves the document, the system publishes their post on the chosen social media account (a Facebook page or Twitter channel). If the editor sets the Publishing time to a future time, the system schedules the publishing of the post to the entered time. Users can view both scheduled and published posts in Kentico in the Facebook or Twitter application.

Editors need permissions for the Social media module to use automatic posting – either Modify or Modify posts.