> ## Documentation Index
> Fetch the complete documentation index at: https://learn.social.plus/llms.txt
> Use this file to discover all available pages before exploring further.

# Text Posts

> Create text posts with the current Social+ SDKs, including optional structured links where supported.

Text posts publish written content to a user feed, a community feed, or the current user's own feed. Use them for plain updates, status messages, and posts that attach structured link metadata.

<CardGroup cols={2}>
  <Card title="Flexible Targets" icon="users-viewfinder">
    Publish to user feeds, community feeds, or the current user's feed depending on the SDK target API.
  </Card>

  <Card title="Optional Enrichment" icon="link">
    TypeScript, Android, and iOS can attach structured links during text post creation.
  </Card>
</CardGroup>

## Parameters

| Parameter    | Required                      | Description                                                         |
| ------------ | ----------------------------- | ------------------------------------------------------------------- |
| `text`       | Yes                           | Text content for the post body.                                     |
| `targetType` | Yes for explicit feed targets | Feed target, usually `community` or `user`.                         |
| `targetId`   | Yes for explicit feed targets | Community ID or user ID for the target feed.                        |
| `metadata`   | No                            | Custom metadata stored with the post where supported.               |
| `mentionees` | No                            | User mention payload where supported by the platform builder.       |
| `links`      | No                            | Structured link metadata supported by TypeScript, Android, and iOS. |

## Create a Text Post

The examples below create a text post in a community. Use the equivalent user target method or target type when posting to a user feed.

<CodeGroup>
  ```swift iOS theme={null}
  let postRepository = AmityPostRepository()
  let builder = AmityTextPostBuilder()
  builder.setText("Hello community")

  let post = try await postRepository.createTextPost(
      builder,
      targetId: communityId,
      targetType: .community,
      metadata: nil,
      mentionees: nil
  )
  ```

  ```kotlin Android theme={null}
  postRepository.createTextPost(
      targetType = AmityPost.TargetType.COMMUNITY,
      targetId = communityId,
      text = "Hello community"
  )
      .subscribe({ post ->
          showSuccessMessage(post.getPostId())
      }, { error ->
          handleGeneralError(error)
      })
  ```

  ```typescript TypeScript theme={null}
  import { PostRepository } from "@amityco/ts-sdk";

  const { data: post } = await PostRepository.createPost({
    targetType: "community",
    targetId: communityId,
    data: {
      text: "Hello community",
    },
  });
  ```

  ```dart Flutter theme={null}
  final post = await AmitySocialClient.newPostRepository()
      .createPost()
      .targetCommunity(communityId)
      .text('Hello community')
      .createTextPost();
  ```
</CodeGroup>

## Add Structured Links

TypeScript, Android, and iOS expose a `links` field when creating a text post. Fetch preview metadata first if the post should render a preview card.

<Note>
  Flutter's current public post creation builder supports text, metadata, and user mentions, but it does not expose a structured `links` payload on the text post builder.
</Note>

<CodeGroup>
  ```swift iOS theme={null}
  let postRepository = AmityPostRepository()
  let builder = AmityTextPostBuilder()
  builder.setText("Check this out https://www.amity.co")

  let preview = try await client.getLinkPreviewMetadata(url: "https://www.amity.co")
  let links = [
      AmityLink(
          url: "https://www.amity.co",
          renderPreview: true,
          domain: preview.domain,
          title: preview.title,
          imageUrl: preview.imageUrl
      )
  ]

  let post = try await postRepository.createTextPost(
      builder,
      targetId: communityId,
      targetType: .community,
      metadata: nil,
      mentionees: nil,
      links: links
  )
  ```

  ```kotlin Android theme={null}
  AmityCoreClient.getLinkPreviewMetadata("https://www.amity.co")
      .flatMap { preview ->
          val links = listOf(
              AmityLink(
                  index = null,
                  length = null,
                  url = "https://www.amity.co",
                  renderPreview = true,
                  domain = preview.getDomain(),
                  title = preview.getTitle(),
                  imageUrl = preview.getImageUrl()
              )
          )

          postRepository.createTextPost(
              targetType = AmityPost.TargetType.COMMUNITY,
              targetId = communityId,
              text = "Check this out https://www.amity.co",
              links = links
          )
      }
      .subscribe({ post ->
          showSuccessMessage(post.getPostId())
      }, { error ->
          handleGeneralError(error)
      })
  ```

  ```typescript TypeScript theme={null}
  import { Client, PostRepository } from "@amityco/ts-sdk";

  const preview = await Client.getLinkPreviewMetadata("https://www.amity.co");

  const { data: post } = await PostRepository.createPost({
    targetType: "community",
    targetId: communityId,
    data: {
      text: "Check this out https://www.amity.co",
    },
    links: [
      {
        url: "https://www.amity.co",
        renderPreview: true,
        domain: preview.domain ?? undefined,
        title: preview.title ?? undefined,
        imageUrl: preview.imageUrl ?? undefined,
      },
    ],
  });
  ```
</CodeGroup>

## Query Text Posts

Post query APIs are SDK-specific. For TypeScript, `PostRepository.getPosts` returns a live collection through a callback instead of a promise, so do not call it with `await`.

For structure type values and filtering behavior, see [Posts Overview](../overview) and [Mixed Media Posts](./mixed-media-post).

## Related Topics

<CardGroup cols={3}>
  <Card title="Posts Overview" icon="newspaper" href="../overview">
    Review post concepts, retrieval, and moderation flows.
  </Card>

  <Card title="Query Posts" icon="list" href="../retrieval/query-posts">
    Load text posts back into feed and detail screens.
  </Card>

  <Card title="Mentions" icon="at-sign" href="/social-plus-sdk/core-concepts/content-handling/mentions">
    Add user mention payloads where the platform exposes them.
  </Card>
</CardGroup>
