Skip to content

Commit eee1497

Browse files
authored
Merge pull request #15 from green-api/SW-4489
Added EditMessage support
2 parents c3d5be8 + f07b2dd commit eee1497

4 files changed

Lines changed: 25 additions & 1 deletion

File tree

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022 Green API
3+
Copyright (c) 2025 Green API
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ This method will be called when an incoming message is received. Next, process m
170170
| `serviceMethods.getAvatar` | The method returns the avatar of the correspondent or group chat | [GetAvatar](https://green-api.com/en/docs/api/service/GetAvatar/) |
171171
| `serviceMethods.getContacts` | The method is designed to get a list of contacts of the current account | [GetContacts](https://green-api.com/en/docs/api/service/GetContacts/) |
172172
| `serviceMethods.getContactInfo` | The method is designed to obtain information about the contact | [GetContactInfo](https://green-api.com/en/docs/api/service/GetContactInfo/) |
173+
| `serviceMethods.editMessage` | The method edits a message in a chat | [EditMessage](https://green-api.com/en/docs/api/service/editMessage/) |
173174
| `serviceMethods.deleteMessage` | The method deletes the message from chat | [DeleteMessage](https://green-api.com/en/docs/api/service/deleteMessage/) |
174175
| `serviceMethods.archiveChat` | The method archives the chat | [ArchiveChat](https://green-api.com/en/docs/api/service/archiveChat/) |
175176
| `serviceMethods.unarchiveChat` | The method unarchives the chat | [UnarchiveChat](https://green-api.com/en/docs/api/service/unarchiveChat/) |

README_RUS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ body | тело сообщения (json)
168168
| `serviceMethods.getAvatar` | Метод возвращает аватар корреспондента или группового чата | [GetAvatar](https://green-api.com/docs/api/service/GetAvatar/) |
169169
| `serviceMethods.getContacts` | Метод предназначен для получения списка контактов текущего аккаунта | [GetContacts](https://green-api.com/docs/api/service/GetContacts/) |
170170
| `serviceMethods.getContactInfo` | Метод предназначен для получения информации о контакте | [GetContactInfo](https://green-api.com/docs/api/service/GetContactInfo/) |
171+
| `serviceMethods.editMessage` | Метод редактирует сообщение в чате | [EditMessage](https://green-api.com/docs/api/service/editMessage/) |
171172
| `serviceMethods.deleteMessage` | Метод удаляет сообщение из чата | [DeleteMessage](https://green-api.com/docs/api/service/deleteMessage/) |
172173
| `serviceMethods.archiveChat` | Метод архивирует чат | [ArchiveChat](https://green-api.com/docs/api/service/archiveChat/) |
173174
| `serviceMethods.unarchiveChat` | Метод разархивирует чат | [UnarchiveChat](https://green-api.com/docs/api/service/unarchiveChat/) |

src/tools/ServiceMethods.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,28 @@ public function deleteMessage( string $chatId, string $idMessage ): stdClass {
127127
'{{host}}/waInstance{{idInstance}}/DeleteMessage/{{apiTokenInstance}}', $requestBody );
128128
}
129129

130+
/**
131+
* The method edits a message in a chat.
132+
*
133+
* @param string $chatId
134+
* @param string $idMessage
135+
* @param string $message
136+
*
137+
* @return stdClass
138+
* @link https://green-api.com/en/docs/api/service/EditMessage/
139+
*/
140+
public function editMessage( string $chatId, string $idMessage, string $message ): stdClass {
141+
142+
$requestBody = [
143+
'chatId' => $chatId,
144+
'idMessage' => $idMessage,
145+
'message' => $message,
146+
];
147+
148+
return $this->greenApi->request( 'POST',
149+
'{{host}}/waInstance{{idInstance}}/EditMessage/{{apiTokenInstance}}', $requestBody );
150+
}
151+
130152
/**
131153
* The method unarchives a chat.
132154
*

0 commit comments

Comments
 (0)