1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2024-12-29 02:57:35 +02:00
OpenIntegrations/docs/en/md/Slack/Message-management/Edit-message.md

92 lines
1.9 KiB
Markdown
Raw Normal View History

---
sidebar_position: 3
---
# Edit message
Edits the content of an existing message
*Function EditMessage(Val Token, Val Channel, Val Timestamp, Val Text = "", Val BlockArray = "") Export*
| Parameter | CLI option | Type | Destination |
|-|-|-|-|
| Token | --token | String | Bot token |
| Channel | --channel | String | Channel ID |
| Timestamp | --stamp | String | Message timestamp |
| Text | --text | String | New message text |
| BlockArray | --blocks | Array of Structure | JSON array of block descriptions |
Returns: Key-Value Pair - Serialized JSON response from Slack
```bsl title="Code example"
Channel = "C070VPMKN8J";
Timestamp = "1714146538.221929";
Text = "TestMessage2";
Response = OPI_Slack.EditMessage(Token, Channel, Timestamp, Text); //Map
Response = OPI_Tools.JSONString(Response); //JSON string
```
```sh title="CLI command example"
oint slack EditMessage --token %token% --channel "C070VPMKN8J" --stamp "1714146538.221929" --text "TestMessage2" --blocks %blocks%
2024-06-05 11:58:00 +02:00
```
```json title="Result"
{
"ok": true,
"channel": "C06UFNUTKUL",
"ts": "1714146538.221929",
"message": {
"user": "U06UG1CAYH2",
"type": "message",
"ts": "1714146538.221929",
"bot_id": "B06TZ0MJV5M",
"app_id": "A06TYNH45RV",
"text": "TestMessage2",
"team": "T06UD92BS3C",
"bot_profile": {
"id": "B06TZ0MJV5M",
"app_id": "A06TYNH45RV",
"name": "OpenIntegrations",
"icons": {
"image_36": "https://a.slack-edge.com/80588/img/plugins/app/bot_36.png",
"image_48": "https://a.slack-edge.com/80588/img/plugins/app/bot_48.png",
"image_72": "https://a.slack-edge.com/80588/img/plugins/app/service_72.png"
},
"deleted": false,
"updated": 1713205238,
"team_id": "T06UD92BS3C"
},
"blocks": [
{
"type": "rich_text",
"block_id": "MO6",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "text",
"text": "TestMessage2"
}
]
}
]
}
]
}
}
```