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. |
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.
caution
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": {
"sticker": 12345, // Required property for sendSticker
"protect_content": true
},
"method": "sendSticker"
}
Channel restrictions
raw
is only supported in the following channels:
- Chat API
- Microsoft Teams
- Telegram
- Viber
- WhatsApp (direct connection)
How to use
Send a contact in Telegram
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": {
"phone_number": "16012345678", // Required property for sendContact
"first_name": "Example company" // Required property for sendContact
},
"method": "sendContact"
});
Sending file attachments in Microsoft Teams
For scripts made for the Microsoft Teams channel, you can use the attachments
property in body
to send file attachments to the chat.
- When switching to the
SendFile
state, the bot will send a card asking for permission to upload the file to OneDrive. - Depending on whether the user allows or declines the upload, an
acceptFile
ordeclineFile
event will be triggered in the script.
state: SendFile
script:
$response.replies = $response.replies || [];
$response.replies.push({
"type": "raw",
"body": {
"type": "message",
"from": $request.rawRequest.from,
"recipient": $request.rawRequest.recipient,
"conversation": $request.rawRequest.conversation,
"attachments": [{
"name": "example.txt",
"contentType": "application/vnd.microsoft.teams.card.file.consent",
"content": {
"description": "This is an example text file.",
"acceptContext": {
"fileUrl": "https://example.com/file.txt"
},
"declineContext": {}
}
}],
"replyToId": $request.rawRequest.id
}
});
state: AcceptFile
event: acceptFile
a: Here is the document with all the information you need:
script:
$response.replies = $response.replies || [];
$response.replies.push({
"type": "raw",
"body": {
"type": "message",
"from": $request.rawRequest.from,
"recipient": $request.rawRequest.recipient,
"conversation": $request.rawRequest.conversation,
"attachments": [{
"contentType": "application/vnd.microsoft.teams.card.file.info",
"content": {
"uniqueId": $request.data.eventData.uniqueId
},
"contentUrl": $request.data.eventData.contentUrl,
"name": $request.data.eventData.name
}],
"replyToId": $request.rawRequest.id
}
});
state: Decline
event: declineFile
a: Unfortunately, I can’t send you the file without your consent.