Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python SDK : Communication messages #33946

Merged
merged 68 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
0fd0ed7
messaging python SDK
Shamkh Jan 17, 2024
c775101
reverting kind change
Shamkh Jan 17, 2024
b564635
add new rest api commimt changes
Shamkh Jan 21, 2024
096e07a
adding samples
Shamkh Jan 24, 2024
3e0cdf6
adding samples
Shamkh Jan 26, 2024
b4d5fa3
Merge branch 'Azure:main' into CommunicationMessagesTypeSpec
Shamkh Feb 14, 2024
ec33a2c
Merge branch 'Azure:main' into CommunicationMessagesTypeSpec
Shamkh Feb 14, 2024
4043d33
latest rest api changes merge
Shamkh Feb 15, 2024
3de93f1
review comments
Shamkh Feb 15, 2024
68fe23b
build failures
Shamkh Feb 15, 2024
16c5b2d
build failures
Shamkh Feb 16, 2024
e686266
build failures
Shamkh Feb 16, 2024
ba39718
Adding AAD auth
Shamkh Feb 19, 2024
a0547a3
adding asset.json
Shamkh Feb 20, 2024
54f50b4
readme update
Shamkh Feb 20, 2024
40cb000
plint issues fix
Shamkh Feb 21, 2024
a26bbce
changelog update
Shamkh Feb 21, 2024
2c07564
plint issues fix
Shamkh Feb 21, 2024
bb8d0a2
buildfix
Shamkh Feb 21, 2024
087384d
test fix
Shamkh Feb 21, 2024
0af15bc
revert job router change
Shamkh Feb 22, 2024
4c10624
test fix.
Shamkh Feb 22, 2024
20c45cf
testfix
Shamkh Feb 22, 2024
0fb5f23
test fix
Shamkh Feb 22, 2024
785cee1
test fix
Shamkh Feb 22, 2024
996c7a7
review comments
Shamkh Feb 23, 2024
a809610
samples for Image messages
Shamkh Feb 23, 2024
65a5525
adding to code owners
Shamkh Feb 23, 2024
a8178b4
Merge branch 'Azure:main' into CommunicationMessagesTypeSpec
Shamkh Feb 24, 2024
0e32a3d
review comments
Shamkh Feb 27, 2024
99705bd
Merge branch 'Azure:main' into CommunicationMessagesTypeSpec
Shamkh Feb 28, 2024
dc391f7
Merge branch 'Azure:main' into CommunicationMessagesTypeSpec
Shamkh Feb 28, 2024
cdc984d
adding iteratable bytes to download media
Shamkh Feb 29, 2024
a621f21
lint issues
Shamkh Feb 29, 2024
b9938bf
lint issues
Shamkh Feb 29, 2024
774b81e
review comments
Shamkh Mar 7, 2024
fe84204
Merge branch 'Azure:main' into CommunicationMessagesTypeSpec
Shamkh Mar 7, 2024
2038b4b
tsp commit update
Shamkh Mar 7, 2024
8353575
Merge branch 'CommunicationMessagesTypeSpec' of https://github.com/Sh…
Shamkh Mar 7, 2024
11b61ac
Update sdk/communication/azure-communication-messages/samples/send_te…
Shamkh Mar 7, 2024
e8052dc
Update sdk/communication/azure-communication-messages/samples/send_te…
Shamkh Mar 7, 2024
6c60dae
Update sdk/communication/azure-communication-messages/samples/send_te…
Shamkh Mar 7, 2024
d146fda
Update sdk/communication/azure-communication-messages/samples/send_te…
Shamkh Mar 7, 2024
77f666b
review comments
Shamkh Mar 7, 2024
61d4e2b
Merge branch 'CommunicationMessagesTypeSpec' of https://github.com/Sh…
Shamkh Mar 7, 2024
0bbf9d3
Update sdk/communication/azure-communication-messages/samples/send_te…
Shamkh Mar 7, 2024
d687905
Update sdk/communication/azure-communication-messages/samples/send_im…
Shamkh Mar 7, 2024
756f453
Update sdk/communication/azure-communication-messages/README.md
Shamkh Mar 7, 2024
3b0b189
Update sdk/communication/azure-communication-messages/samples/send_im…
Shamkh Mar 7, 2024
fbeb2ea
Update sdk/communication/azure-communication-messages/samples/send_im…
Shamkh Mar 7, 2024
dd72bfb
Update sdk/communication/azure-communication-messages/samples/send_im…
Shamkh Mar 7, 2024
37ed13d
Update sdk/communication/azure-communication-messages/samples/send_im…
Shamkh Mar 7, 2024
ae0f984
Update sdk/communication/azure-communication-messages/samples/send_te…
Shamkh Mar 7, 2024
91870e3
Update sdk/communication/azure-communication-messages/samples/send_te…
Shamkh Mar 7, 2024
e409f56
Update sdk/communication/azure-communication-messages/samples/send_te…
Shamkh Mar 7, 2024
52995ea
Update sdk/communication/azure-communication-messages/samples/send_te…
Shamkh Mar 7, 2024
cbc5dc1
Update sdk/communication/azure-communication-messages/samples/send_te…
Shamkh Mar 7, 2024
b6bff0a
review comments
Shamkh Mar 7, 2024
9157231
review comments
Shamkh Mar 7, 2024
70c36c8
Merge branch 'Azure:main' into CommunicationMessagesTypeSpec
Shamkh Mar 8, 2024
0395b2c
Merge branch 'Azure:main' into CommunicationMessagesTypeSpec
Shamkh Mar 8, 2024
9a64138
adding Token credential Sample
Shamkh Mar 9, 2024
a07c616
merge
Shamkh Mar 9, 2024
898b0d9
samples improvement
Shamkh Mar 9, 2024
44b34b1
Merge branch 'Azure:main' into CommunicationMessagesTypeSpec
Shamkh Mar 12, 2024
a897e69
Merge branch 'Azure:main' into CommunicationMessagesTypeSpec
Shamkh Mar 12, 2024
f9242f7
Iterable bytes changes
Shamkh Mar 13, 2024
c3c40d7
removing job router references.
Shamkh Mar 13, 2024
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
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@
# PRLabel: %Communication - SMS
/sdk/communication/azure-communication-sms/ @DimaKolomiiets @gfeitosa-msft @besh2014 @phermanov-msft @ilyapaliakou-msft

# PRLabel: %Communication - Messages
/sdk/communication/azure-communication-messages/ @shamkh

# PRLabel: %Communication - Identity
/sdk/communication/azure-communication-identity/ @Azure/acs-identity-sdk @AikoBB @maximrytych-ms @mjafferi-msft

Expand Down
16 changes: 16 additions & 0 deletions sdk/communication/azure-communication-messages/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Release History

## 1.0.0 (2024-02-01)

This is the GA release of Azure Communication Messages Python SDK. For more information, please see the [README][read_me].

### Features Added
- Using `NotificationMessagesClient`
- Send Text messages
- Send Template messages
- Send Media messages
- Using `MessageTemplateClient`
- Get list of all WhatsApp templates.

<!-- LINKS -->
[read_me]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/communication/azure-communication-messages/README.md
21 changes: 21 additions & 0 deletions sdk/communication/azure-communication-messages/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Copyright (c) Microsoft Corporation.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
7 changes: 7 additions & 0 deletions sdk/communication/azure-communication-messages/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include *.md
include LICENSE
include azure/communication/messages/py.typed
recursive-include tests *.py
recursive-include samples *.py *.md
include azure/__init__.py
include azure/communication/__init__.py
104 changes: 104 additions & 0 deletions sdk/communication/azure-communication-messages/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Azure Communication Messages Package client library for Python

This package contains a Python SDK for Azure Communication Services for Messages(Advanced Messaging).
Read more about Azure Communication Services [here][product_docs]

[Source code][source] | [Package (Pypi)][pypi] | [Product documentation][product_docs]

## _Disclaimer_

_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_

## Getting started

### Prequisites

- Python 3.8 or later is required to use this package.
- You need an [Azure subscription][azure_sub] to use this package.
- An existing Communication Messages instance.

## Key concepts

Azure Communication Services enables you to send and receive WhatsApp messages using the Azure Communication Services Messages SDK. It can be used to send out messages like appointment reminders, shipping updates, two-factor authentication, and other notification scenarios.

### Installating the package

```bash
python -m pip install azure-communication-messages
```

### Create with an Azure Active Directory Credential

To use an [Azure Active Directory (AAD) token credential][authenticate_with_token],
provide an instance of the desired credential type obtained from the
[azure-identity][azure_identity_credentials] library.

To authenticate with AAD, you must first [pip][pip] install [`azure-identity`][azure_identity_pip]

After setup, you can choose which type of [credential][azure_identity_credentials] from azure.identity to use.
As an example, [DefaultAzureCredential][default_azure_credential] can be used to authenticate the client:

Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables:
`AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`

Use the returned token credential to authenticate the client:

```python
>>> from azure.communication.messages import NotificationMessagesClient
>>> from azure.identity import DefaultAzureCredential
>>> client = NotificationMessagesClient(endpoint='<endpoint>', credential=DefaultAzureCredential())
```

### Examples

```python
>>> from azure.communication.messages import NotificationMessagesClient
>>> from azure.identity import DefaultAzureCredential
>>> from azure.core.exceptions import HttpResponseError

>>> client = NotificationMessagesClient(endpoint='<endpoint>', credential=DefaultAzureCredential())
>>> try:
# write test code here
except HttpResponseError as e:
print('service responds error: {}'.format(e.response.json()))

```

## Troubleshooting

Running into issues? This section should contain details as to what to do there.

## Next steps

- [Read more about Azure Communication Services Messages][nextsteps]

## Contributing

This project welcomes contributions and suggestions. Most contributions require
you to agree to a Contributor License Agreement (CLA) declaring that you have
the right to, and actually do, grant us the rights to use your contribution.
For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether
you need to provide a CLA and decorate the PR appropriately (e.g., label,
comment). Simply follow the instructions provided by the bot. You will only
need to do this once across all repos using our CLA.

This project has adopted the
[Microsoft Open Source Code of Conduct][code_of_conduct]. For more information,
see the Code of Conduct FAQ or contact [email protected] with any
additional questions or comments.

<!-- LINKS -->
[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
[authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token
[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials
[azure_identity_pip]: https://pypi.org/project/azure-identity/
[default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential
[pip]: https://pypi.org/project/pip/
[azure_sub]: https://azure.microsoft.com

[source]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/communication/azure-communication-messages
[product_docs]: https://docs.microsoft.com/azure/communication-services/overview
[pypi]: https://pypi.org
[nextsteps]: https://learn.microsoft.com/azure/communication-services/concepts/advanced-messaging/whatsapp/whatsapp-overview
6 changes: 6 additions & 0 deletions sdk/communication/azure-communication-messages/assets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "python",
"TagPrefix": "python/communication/azure-communication-messages",
"Tag": "python/communication/azure-communication-messages_1c6b0f13ac"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._client import NotificationMessagesClient
from ._client import MessageTemplateClient
from ._version import VERSION

__version__ = VERSION

try:
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
__all__ = [
'NotificationMessagesClient',
'MessageTemplateClient',
]
__all__.extend([p for p in _patch_all if p not in __all__])

_patch_sdk()
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------

from enum import Enum
from azure.core import CaseInsensitiveEnumMeta


class ApiVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta):
V2023_08_24_PREVIEW = "2023-08-24-preview"
V2024_02_01 = "2024-02-01"


DEFAULT_VERSION = ApiVersion.V2024_02_01.value
Loading