---
title: Configuring automatic posting to Facebook or Twitter
related:
  - https://docs.kentico.com/k8/community-features/integrating-social-media/connecting-kentico-to-social-media.md
  - https://docs.kentico.com/k8/community-features/integrating-social-media/adding-social-media-accounts.md
  - https://docs.kentico.com/k8/community-features/integrating-social-media/posting-to-facebook-and-twitter.md
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

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.

- To post information about a certain section of the content tree, regardless of the document type, choose [Publishing to Facebook or Twitter using a workflow step](#publishing-to-facebook-or-twitter-using-a-workflow-step).
- To post information about documents of one specific document type (e.g., blog post), either manually, or automatically at the time of publishing, choose [Publishing to Facebook or Twitter using form controls](#publishing-to-facebook-or-twitter-using-form-controls).

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.

> **Info:** 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](#publishing-to-facebook-or-twitter-using-form-controls).

1. [Connect Kentico to the social media](https://docs.kentico.com/k8/community-features/integrating-social-media/connecting-kentico-to-social-media.md) and [Add a social media account](https://docs.kentico.com/k8/community-features/integrating-social-media/adding-social-media-accounts.md).
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](https://docs.kentico.com/k8/managing-website-content/configuring-the-environment-for-content-editors/configuring-workflows/designing-advanced-workflows.md) with the **Publish to Facebook** or **Publish to Twitter** step.

   ![Publishing to Twitter using advanced workflow](https://docs.kentico.com/docsassets/k8/configuring-automatic-posting-to-facebook-or-twitter/publish_twitter_workflow.png "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](https://docs.kentico.com/k8/macro-expressions.md) 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.

> **Note:** **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.

> **Tip:** 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](https://docs.kentico.com/k8/community-features/integrating-social-media/connecting-kentico-to-social-media.md) and [Add a social media account](https://docs.kentico.com/k8/community-features/integrating-social-media/adding-social-media-accounts.md).
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](https://docs.kentico.com/docsassets/k8/configuring-automatic-posting-to-facebook-or-twitter/post_twitter_pages.png "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.

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