> For the complete documentation index, see [llms.txt](https://docs.developers.symphony.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.developers.symphony.com/embedded-modules/embedded-mode/pin-a-message.md).

# Pin a message

The `pinMessage` function exposed by the SDK allows you to pin at the top of a chat a message, specified by its `messageId`.

If another message is already pinned, it is replaced.

Currently it is not possible to programmatically unpin a message.

The user needs to be owner of the room to be able to pin the message, otherwise an error will be returned.

**Parameters**

<table><thead><tr><th width="191">Parameter</th><th width="132.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>messageId</td><td>string</td><td>Id of the message to be pinned.</td></tr></tbody></table>

#### Returned promise

The Pin message function returns a [**JavaScript Promise**](https://www.w3schools.com/js/js_promise.asp) that will resolve once the action has been completed. The promise has the following interface:

```javascript
Promise<true | SdkError>;
```

Success

\- In case of success, the promise returns `true`.

Error

\- In case of error, the promise returns a `SdkError` structure, with the following properties:

<table><thead><tr><th width="196">Parameter</th><th width="113">Type</th><th>Description</th></tr></thead><tbody><tr><td>type</td><td>string</td><td>Type of error:<br><code>ERROR</code> for generic errors;<br><code>MESSAGE_ID_NOT_FOUND</code> if the message Id is not valid</td></tr><tr><td>message</td><td>string</td><td>Description of the error.</td></tr><tr><td>data</td><td>Object</td><td>Additional data on the error, with the message Id that was specified for the pin method.</td></tr></tbody></table>

#### Example

```javascript
const result = await window.symphony.sdk.pinMessage('ORRT7G00Bm0skftV+kK2tX///nZz1Vs4bQ==');
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.developers.symphony.com/embedded-modules/embedded-mode/pin-a-message.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
