tock / ai.tock.bot.engine.action / SendChoice

# SendChoice

`class SendChoice : Action` (source)

A user choice (click on a button or direct action).

### Constructors

#### <init> | `SendChoice(playerId: PlayerId, applicationId: String, recipientId: PlayerId, intentName: String, step: StoryStep<out StoryHandlerDefinition>?, parameters: Map<String, String> = emptyMap(), id: Id<Action> = newId(), date: Instant = Instant.now(), state: EventState = EventState(), metadata: ActionMetadata = ActionMetadata())` A user choice (click on a button or direct action). `SendChoice(playerId: PlayerId, applicationId: String, recipientId: PlayerId, intentName: String, parameters: Map<String, String> = emptyMap(), id: Id<Action> = newId(), date: Instant = Instant.now(), state: EventState = EventState(), metadata: ActionMetadata = ActionMetadata())`

### Properties

#### intentName | `val intentName: String`
#### parameters | `val parameters: Map<String, String>`
#### referralParameter | Returns the referral parameter if any. `val referralParameter: String?`

### Functions

#### sourceAppId | The source application id (if any) ie the creator of the choice. `fun sourceAppId(): String?`
#### step | The step of this choice (when applicable). `fun step(): String?`
#### toEncodedId | Provides the id used by connectors. `fun toEncodedId(): String`
#### toMessage | `fun toMessage(): Message`
#### toString | `fun toString(): String`

### Companion Object Properties

#### EXIT_INTENT | `const val EXIT_INTENT: String`
#### IMAGE_PARAMETER | `const val IMAGE_PARAMETER: String`
#### LOGIN_INTENT | `const val LOGIN_INTENT: String`
#### LOGOUT_INTENT | `const val LOGOUT_INTENT: String`
#### NLP | `const val NLP: String`
#### PHONE_CALL_INTENT | `const val PHONE_CALL_INTENT: String`
#### PREVIOUS_INTENT_PARAMETER | `const val PREVIOUS_INTENT_PARAMETER: String`
#### REFERRAL_PARAMETER | `const val REFERRAL_PARAMETER: String`
#### SOURCE_APP_ID | `const val SOURCE_APP_ID: String`
#### STEP_PARAMETER | `const val STEP_PARAMETER: String`
#### TITLE_PARAMETER | `const val TITLE_PARAMETER: String`
#### URL_PARAMETER | `const val URL_PARAMETER: String`

### Companion Object Functions

#### decodeChoice | Decodes an id and returns an action. `fun decodeChoice(id: String, senderId: PlayerId, applicationId: String, recipientId: PlayerId, referralParameter: String? = null): Action`
#### decodeChoiceId | Decodes an id - returns the intentName and the parameters map. `fun decodeChoiceId(id: String): Pair<String, Map<String, String>>`
#### encodeChoiceId | Encodes a choice id. `fun encodeChoiceId(bus: Bus<*>, intent: IntentAware, step: StoryStep<out StoryHandlerDefinition>? = null, parameters: Map<String, String> = emptyMap()): String` `fun encodeChoiceId(bus: Bus<*>, intent: IntentAware, step: String? = null, parameters: Map<String, String> = emptyMap()): String` `fun encodeChoiceId(intent: IntentAware, step: StoryStep<out StoryHandlerDefinition>? = null, parameters: Map<String, String> = emptyMap(), busStep: StoryStep<out StoryHandlerDefinition>? = null, currentIntent: Intent? = null, sourceAppId: String? = null): String` `fun encodeChoiceId(intent: IntentAware, step: String?, parameters: Map<String, String>, busStep: String?, currentIntent: Intent?, sourceAppId: String? = null): String`
#### encodeNlpChoiceId | Encodes a choice id where text will be analysed by NLP engine. `fun encodeNlpChoiceId(text: String): String`