raw
Use the raw
reply type for using channel-specific methods.
Properties
Property | Type | Required | Description |
---|---|---|---|
body |
Object | Yes | Reply body. Contains channel-specific properties. |
method |
String | No | Channel-specific method. |
Alice
You can pass the response
properties into the body
object.
card
is a description of a message that supports images. The content depends on the value of thecard.type
field:BigImage
is one image.ImageGallery
is a gallery of images.ItemsList
is a list of images.
directives
. The content depends on the directive type:audio_player
launches the audio player on smart speakers.confirm_purchase
confirms a purchase made by a skill.start_account_linking
starts the authorization process in a skill.start_purchase
starts the purchase script.
If you use the raw
reply type, you need to specify the required properties for response
.
Otherwise, an error occurs while processing this reply in Alice.
Example:
-
Creating a card.
{ "type": "raw", "body": { "text": "Listen to your favorite music anywhere you are", // Required property for response "end_session": false, // Required property for response "card": { "type": "BigImage", "image_id": "10123456789", "title": "Listen to your favorite music anywhere you are" } } }
-
Specifying a directive for linking accounts.
{ "type": "raw", "body": { "text": "Buy a book", // Required property for response "end_session": false, // Required property for response "directives": { "start_account_linking": {} } } }
Telegram
In method
, you can use methods that Telegram supports. For example:
editMessageText
edits the bot’s last text message.sendSticker
sends static, animated, or video stickers.sendVoice
sends audio files that are displayed as playable voice messages.
The properties to be passed into body
depend on the selected method.
You can find more information about methods and properties in the Telegram Bot API documentation.
If you use the raw
reply type, you need to specify the required properties for the method selected.
Otherwise, an error occurs while processing this reply in Telegram.
Example:
{
"type": "raw",
"body": {
"chat_id": "@example", // Required property for sendSticker
"sticker": 12345, // Required property for sendSticker
"protect_content": true
},
"method": "sendSticker"
}
Channel restrictions
raw
is only supported in the following channels:
- Aimybox
- Alice
- Amazon Alexa
- Chat API
- Google Assistant
- Salut
- Telegram
- Viber
How to use
Consider an example of using the sendContact
method for a Telegram channel.
When switching to the SendContact
state, the bot will send a card with a phone number to the chat.
state: SendContact
a: Thanks for the order!
a: You can check its status by calling this phone number:
script:
$response.replies = $response.replies || [];
$response.replies.push({
"type": "raw",
"body": {
"chat_id": $request.rawRequest.message.chat.id, // Required property for sendContact
"phone_number": "16012345678", // Required property for sendContact
"first_name": "Example company" // Required property for sendContact
},
"method": "sendContact"
});