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

# composeCast

> Open the cast composer with a suggested cast

Open the cast composer with a suggested cast. The user will be able to modify
the cast before posting it.

<img src="https://mintcdn.com/neynar/Uxa-Ieom0HVNjtON/miniapps/compose_cast_action.png?fit=max&auto=format&n=Uxa-Ieom0HVNjtON&q=85&s=689f2df3d6e04ccd5caae125ba4c713f" alt="composing a cast" width="1756" height="1194" data-path="miniapps/compose_cast_action.png" />

*An app prompts the user to cast and includes an embed.*

## Usage

```ts theme={"system"}
import { sdk } from '@farcaster/miniapp-sdk'

const text = "I just learned how to compose a cast";
const embeds = ["https://miniapps.farcaster.xyz/docs/sdk/actions/compose-cast"] as [string];

await sdk.actions.composeCast({
  text,
  embeds,
})
```

## Parameters

### text (optional)

* **Type:** `string`

Suggested text for the body of the cast.

Mentions can be included using the human-writeable form (e.g. @farcaster).

### embeds (optional)

* **Type:** `[] | [string] | [string, string]`

Suggested embeds. Max two.

### parent (optional)

* **Type:** `{ type: 'cast'; hash: string }`

Suggested parent of the cast.

### close (optional)

* **Type:** `boolean`

Whether the app should be closed when this action is called. If true the app
will be closed and the action will resolve with no result.

### channelKey (optional)

* **Type:** `string`

Whether the cast should be posted to a channel.

## Return Value

The cast posted by the user, or `undefined` if set to close.

**Note:** The `cast` property in the result can be `null` if the user decides not to create the cast.

```ts theme={"system"}
import { sdk } from "@farcaster/miniapp-sdk";

const result = await sdk.actions.composeCast({
  text: "I just learned how to compose a cast",
  embeds: ["https://miniapps.farcaster.xyz/docs/sdk/actions/compose-cast"],
  channelKey: "farcaster" // optional channel
})

// result.cast can be null if user cancels
if (result?.cast) {
  console.log(result.cast.hash)
  console.log(result.cast.channelKey) // includes channel if posted to one
}
```
