moe-inform-client 0.0.2
This Python Package helps you in sending notifications through MoEngage Inform
Requires Python: >=3.9
Keywords: MoEngage,Inform,MoEngage Inform,Customer Engagement,Transactional Alerts

# `moe-inform-client`

## Table of contents

- Overview
- Installation
- Requirements
- Usage
- Troubleshooting and FAQs
- APIs
- Contributing
- License

## Overview

This Python Package helps you in sending notifications through [MoEngage Inform](https://www.moengage.com/blog/introducing-transactional-alerts-moengage-inform/), the smartest way to design &amp; deliver notifications. Deliver your transactional messages to any channel through one API. Currently Email and SMS channels are supported.
For an official overview of Inform Product, please see the [Inform Overview](https://help.moengage.com/hc/en-us/articles/10672957787284-Overview-Inform) or contact us at [MoEngage](https://moengage.com/). Happy engaging your users!

## Installation
Install from PyPI using [pip](http://www.pip-installer.org/en/latest/):

```shell
$ pip install moe-inform-client
```

python3.9 or later is required.

## Requirements
```text
  StrEnum~=0.4.9
  urllib3~=1.26.5
  jsonschema~=4.17.3
```
Note: Install these individually if any issue raises in installation of these requirements like this 
```shell
$ pip install StrEnum~=0.4.9
```

## Usage

```python
from informclient import InformClient
"""
base_url = "https://sandbox-inform-api-XX.moengage.com"
app_id = "XXXXXXXXXX"
api_secret = "XXXXXXXXXX"
"""
client = InformClient(base_url, app_id, api_secret)
payload = {
    "alert_id": "XXXXXXXXXX",
    "user_id": "XXXXXXXXXX",
    "transaction_id": "XXXXXXXXXX",
    "payloads": 
        {
            "SMS": 
                {
                    "recipient":"+91XXXXXXXXXX",
                    "personalized_attributes": {
                        "attr": "value"
                    }
                },
            "EMAIL":
                {
                    "recipient":"XXXXXXXXXX@example.com",
                    "personalized_attributes": {
                        "attr": "value"
                    }
                }
        }
}
response = client.send_alert(payload)
print(response)
```

## Troubleshooting and FAQs
- ### What is the format of base_url?
    - The base_url should be of the format "https://sandbox-inform-api-XX.moengage.com"
    
- ### Why do I get **sslcertverificationerror** while sending an alert? 
    - Inform Client is only supported through secured HTTPS connection requests. If the request throws
      **sslcertverificationerror**. Run the following commands.
        - For **MacOSx**
            ```shell
            $ pip install certifi
            $ /Applications/Python\ 3.9/Install\ Certificates.command
            ```
        - For **Windows**
            ```shell
            $ pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org informclient
            ```
 

## APIs

For a full description of request and response payloads and properties, please see the [Official Inform API docs](https://developers.moengage.com/hc/en-us/articles/10699624590868).

- `send_alert(requestbody) (response, Error)` [[See alert Description ]](https://help.moengage.com/hc/en-us/articles/10717041310484-Test-Alert#attributes-0-5)

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/moengage/inform-client-python. See [CONTRIBUTING.md](CONTRIBUTING.md) for more info.

## License

This package is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
MIT LICENSE

Copyright 2023 MOENGAGE

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.