---
schema_version: "1"
id: b3d19e2d626147df2cfac9c4a77dcc93b4a29bf6fefef8c79bf01b86c2c7b0e3
title: Send Message Use Cases
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/service-cloud/messaging-api/references/send-message-use-cases.md
canonical_url: https://developer.salesforce.com/docs/service/messaging-api/references/about/send-message-use-cases.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: b056e54fe044bf01bf0244375022adfc9c692a8db7c45d18b0f15fe84c77efd0
products:
  - Enhanced Chat API
  - Service Cloud Developer Content
---
# Send Message Use Cases

These types are referred by the [Send Message](/docs/service/messaging-api/references/miaw-api-reference?meta=sendMessage) section.

## Send Message with Selected Choices

Request Payload for Messages that contain URLs: The salesforce API parses the message to identify the presence of valid URLs that appear either at the start or end of a text message. Once the URLs are identified, it splits the actual message into multiple messages to render the URL with more information needed for URL previews. For example: A message “Please click on this link https://salesforce.com” is divided into two different messages. The clients receive two different `CONVERSATION_MESSAGE` events from SSE.

- A message containing the text “Please click on this link”
- Another message which contains metadata information regarding the URLs, which can be used to generate previews

Refer to the payload for [Rich Link Preview](https://developer.salesforce.com/docs/service/messaging-api/references/about/message-types-payloads-staticcontentmessage.md#richlink) for more information.

Here is a sample request.

```json
{
  "message": {
    "inReplyToMessageId": "a133c185-73a7-4adf-b6d9-b7fd62babb4e",
    "id": "6fc22906-c24a-4c53-b382-fd091dacd848",
    "messageType": "StaticContentMessage",
    "staticContent": {
      "formatType": "Text",
      "text": "Please click on this link https://salesforce.com"
    }
  },
  "routingAttributes": {
    "_firstName": "jacob",
    "FavoriteFood": "pizza"
  },
  "isNewMessagingSession": true,
  "esDeveloperName": "myDeployment"
}
```

## Send Message with Selected Choices

These are typically defined as Message with the selected choices as a response to a Choices message sent by reps or bots for specific format types like carousels.

Here is a sample payload for the `ChoicesResponseMessage`. The `optionIdentifier` is the identifier pointing to the option selected by the end user.

```json
{
  "message": {
    "id": "2f770c3e-b93f-4c16-b0bd-b459e5b296e3",
    "messageType": "ChoicesResponseMessage",
    "inReplyToMessageId": "6c6950be-e477-4089-a772-adb0bc74d8da",
    "choicesResponse": {
      "formatType": "Selections",
      "selectedOptions": [
        {
          "optionIdentifier": "ee10eba8-be5f-4ce0-b1c6-7a7e86c9e81a"
        }
      ]
    }
  },
  "routingAttributes": {
    "_firstName": "jacob",
    "FavoriteFood": "pizza"
  },
  "isNewMessagingSession": true,
  "esDeveloperName": "myDeployment"
}
```

See the [ChoicesMessage section](https://developer.salesforce.com/docs/service/messaging-api/references/about/message-types-payloads-choicesmessage.md) for more details around the payload for ChoicesMessage and the different supported format types, such as Buttons, Quick Replies and Carousel.

## Send Message with Form Responses

Message with a form containing multiple single or multi select choices that a recipient can select from.

Here is a sample request payload. The example shown below only covers `inputTypeValue` of `SingleInputValue` and value type of `TextValue` and `DateTime`. See the [FormMessage section](https://developer.salesforce.com/docs/service/messaging-api/references/about/message-types-payloads-formmessage.md) for the payload structure.

**note:** There are other `inputValueType` and Value Type combinations that are supported.

```json
{
  "message": {
    "id": "255a0fbf-ab72-4dba-b16d-5fc20031fb82",
    "messageType": "FormResponseMessage",
    "inReplyToMessageId": "373e2b5f-f6e8-47fc-8d06-1af90edae0f9",
    "formResponse": {
      "formatType": "Inputs",
      "inputValues": [
        {
          "inputValueType": "SingleInputValue",
          "inputId": "1",
          "inputLabel": {
            "itemType": "TitleItem",
            "title": "Secure Form"
          },
          "value": {
            "valueType": "TextValue",
            "textValue": "Test Values 1"
          }
        },
        {
          "inputValueType": "SingleInputValue",
          "inputId": "2",
          "inputLabel": {
            "itemType": "TitleItem",
            "title": "Datetime"
          },
          "value": {
            "valueType": "DateTimeValue",
            "dateTimeValue": "2024-04-17T18:59:00.000Z"
          }
        }
      ]
    }
  },
  "routingAttributes": {
    "_firstName": "jacob",
    "FavoriteFood": "pizza"
  },
  "isNewMessagingSession": true,
  "esDeveloperName": "myDeployment"
}
```
