Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 72 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ greenAPI = API.GreenAPI(

### Sending a text message to a WhatsApp number

Link to example: [sendTextMessage.py](./examples/sync/sendTextMessage.py).
Link to example: [sendTextMessage.py](./examples/sync/sending/sendTextMessage.py).

```
response = greenAPI.sending.sendMessage("11001234567@c.us", "Message text")
Expand All @@ -82,7 +82,7 @@ asyncio.run(main())

### Sending an image via URL

Link to example: [sendPictureByLink.py](./examples/sync/sendPictureByLink.py).
Link to example: [sendPictureByLink.py](./examples/sync/sending/sendPictureByLink.py).

```
response = greenAPI.sending.sendFileByUrl(
Expand All @@ -97,7 +97,7 @@ print(response.data)

### Sending an image by uploading from the disk

Link to example: [sendPictureByUpload.py](./examples/sync/sendPictureByUpload.py).
Link to example: [sendPictureByUpload.py](./examples/sync/sending/sendPictureByUpload.py).

```
response = greenAPI.sending.sendFileByUpload(
Expand Down Expand Up @@ -185,7 +185,7 @@ asyncio.run(main())

### Sending a polling message

Link to example: [sendPoll.py](./examples/sync/sendPoll.py).
Link to example: [sendPoll.py](./examples/sync/sending/sendPoll.py).

```
response = greenAPI.sending.sendPoll(
Expand Down Expand Up @@ -215,26 +215,87 @@ response = greenAPI.statuses.sendTextStatus(
print(response.data)
```

### Sending interactive buttons

Link to example: [sendInteractiveButtons.py](../examples/sync/sending/sendInteractiveButtons.py).

```
response = greenAPI.sending.sendInteractiveButtons(
"79001234567@c.us",
"This is message with buttons!",
[{
"type": "call",
"buttonId": "1",
"buttonText": "Call me",
"phoneNumber": "79001234567"
},
{
"type": "url",
"buttonId": "2",
"buttonText": "Green-api",
"url": "https://green-api.com/en/docs/api/sending/SendInteractiveButtons/"
}],
"Check this out",
"Hope you like it"
)

print(response.data)
```

### Sending interactive buttons async

Link to example: [sendInteractiveButtonsAsync.py](../examples/async/sending/sendInteractiveButtonsAsync.py).

```
import asyncio

async def main():
response = await greenAPI.sending.sendInteractiveButtonsAsync(
"79001234567@c.us",
"This is message with buttons!",
[{
"type": "call",
"buttonId": "1",
"buttonText": "Call me",
"phoneNumber": "79001234567"
},
{
"type": "url",
"buttonId": "2",
"buttonText": "Green-api",
"url": "https://green-api.com/en/docs/api/sending/SendInteractiveButtons/"
}],
"Check this out",
"Hope you like it"
)
print(response.data)
asyncio.run(main())
```

## Examples list

| Description | Module |
|----------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|
| Example of sending text | [sendTextMessage.py](./examples/sync/sendTextMessage.pyy) |
| Example of sending text | [sendTextMessage.py](./examples/sync/sending/sendTextMessage.pyy) |
| Example of sending text asynchronously | [sendTextMessageAsync.py](./examples/async/sendMessageAsync.py) |
| Example of sending a picture by URL | [sendPictureByLink.py](./examples/sync/sendPictureByLink.py) |
| Example of sending a picture by URL | [sendPictureByLink.py](./examples/sync/sending/sendPictureByLink.py) |
| Example of sending a file by URL asynchronously | [sendFileByUrlAsync.py](./examples/async/sending/sendFileByUrlAsync.py) |
| Example of sending a picture by uploading from the disk | [sendPictureByUpload.py](./examples/sync/sendPictureByUpload.py) |
| Example of sending a picture by uploading from the disk | [sendPictureByUpload.py](./examples/sync/sending/sendPictureByUpload.py) |
| Example of sending file by uploading from the disk asynchronously | [sendFileByUploadAsync.py](./examples/async/sending/sendFileByUploadAsync.py) |
| Example of a group creation and sending a message to the group | [createGroupAndSendMessage.py](./examples/sync/createGroupAndSendMessage.py) |
| Example of a group creation and sending a message to the group | [createGroupAndSendMessage.py](./examples/sync/sending/createGroupAndSendMessage.py) |
| Example of a group creation and sending a message to the group asynchronously | [createGroupAndSendMessageAsync.py](./examples/async/createGroupAndSendMessageAsync.py) |
| Example of incoming webhooks receiving | [receiveNotification.py](./examples/sync/receiveNotification.py) |
| Example of incoming webhooks receiving asynchronously | [receiveNotificationAsync.py](./examples/async/receiveNotificationAsync.py) |
| Example of sending a polling message | [sendPoll.py](./examples/sync/sendPoll.py) |
| Example of sending a polling message | [sendPoll.py](./examples/sync/sending/sendPoll.py) |
| Example of sending a polling message asynchronously | [sendPollAsync.py](./examples/async/sending/sendPollasync.py) |
| Example of sending a text status | [sendTextStatus.py](./examples/sync/statusesMethods/sendTextStatus.py) |
| Example of sending a text status asynchronously | [sendTextStatusAsync.py](./examples/async/statusesMethods/sendTextStatusAsync.py) |
| Example of creating instance | [CreateInstance.py](./examples/sync/partherMethods/CreateInstance.py) |
| Example of creating instance asynchronously | [CreateInstanceAsync.py](./examples/async/partherMethods/CreateInstanceAsync.py) |
| Example of sending interactive buttons | [SendInteractiveButtons.py](../examples/sync/sending/sendInteractiveButtons.py) |
| Example of sending interactive buttons asynchronously | [SendInteractiveButtonsAsync.py](../examples/async/sending/sendInteractiveButtonsAsync.py) |
| Example of sending interactive buttons with a reply | [SendInteractiveButtonsReply.py](../examples/sync/sending/sendInteractiveButtonsReply.py) |
| Example of sending interactive buttons asynchronously with a reply | [SendInteractiveButtonsReplyAsync.py](../examples/async/sending/sendInteractiveButtonsReplyAsync.py) |

## The full list of the library methods

Expand Down Expand Up @@ -278,17 +339,15 @@ print(response.data)
| `receiving.deleteNotification` | The method is designed to remove an incoming notification from the notification queue | [DeleteNotification](https://green-api.com/en/docs/api/receiving/technology-http-api/DeleteNotification/) |
| `receiving.downloadFile` | The method is for downloading received and sent files | [DownloadFile](https://green-api.com/en/docs/api/receiving/files/DownloadFile/) |
| `sending.sendMessage` | The method is designed to send a text message to a personal or group chat | [SendMessage](https://green-api.com/en/docs/api/sending/SendMessage/) |
| `sending.sendButtons` | The method is designed to send a message with buttons to a personal or group chat | [SendButtons](https://green-api.com/en/docs/api/sending/SendButtons/) |
| `sending.sendTemplateButtons` | The method is designed to send a message with interactive buttons from the list of templates in a personal or group chat | [SendTemplateButtons](https://green-api.com/en/docs/api/sending/SendTemplateButtons/) |
| `sending.sendListMessage` | The method is designed to send a message with a selection button from a list of values to a personal or group chat | [SendListMessage](https://green-api.com/en/docs/api/sending/SendListMessage/) |
| `sending.sendFileByUpload` | The method is designed to send a file loaded through a form (form-data) | [SendFileByUpload](https://green-api.com/en/docs/api/sending/SendFileByUpload/) |
| `sending.sendFileByUrl` | The method is designed to send a file downloaded via a link | [SendFileByUrl](https://green-api.com/en/docs/api/sending/SendFileByUrl/) |
| `sending.uploadFile` | The method is designed to upload a file to the cloud storage, which can be sent using the sendFileByUrl method | [UploadFile](https://green-api.com/en/docs/api/sending/UploadFile/) |
| `sending.sendLocation` | The method is designed to send a geolocation message | [SendLocation](https://green-api.com/en/docs/api/sending/SendLocation/) |
| `sending.sendContact` | The method is for sending a message with a contact | [SendContact](https://green-api.com/en/docs/api/sending/SendContact/) |
| `sending.sendLink` | The method is designed to send a message with a link that will add an image preview, title and description | [SendLink](https://green-api.com/en/docs/api/sending/SendLink/) |
| `sending.forwardMessages` | The method is designed for forwarding messages to a personal or group chat | [ForwardMessages](https://green-api.com/en/docs/api/sending/ForwardMessages/) |
| `sending.sendPoll` | The method is designed for sending messages with a poll to a private or group chat | [SendPoll](https://green-api.com/en/docs/api/sending/SendPoll/) |
| `sending.sendInteractiveButtons` | This method is used to send messages with interactive buttons | [sendInteractiveButtons](https://green-api.com/en/docs/api/sending/SendInteractiveButtons/) |
| `sending.sendInteractiveButtonsReply` | This method is used to send messages with interactive buttons with a reply | [sendInteractiveButtonsReply](https://green-api.com/en/docs/api/sending/SendInteractiveButtonsReply/) |
| `serviceMethods.checkWhatsapp` | The method checks if there is a WhatsApp account on the phone number | [CheckWhatsapp](https://green-api.com/en/docs/api/service/CheckWhatsapp/) |
| `serviceMethods.getAvatar` | The method returns the avatar of the correspondent or group chat | [GetAvatar](https://green-api.com/en/docs/api/service/GetAvatar/) |
| `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/) |
Expand Down
Loading