human-internet / humanid-core

humanID Core
GNU Lesser General Public License v3.0
2 stars 0 forks source link

Add low balance alert feature #70

Closed kofimokome closed 1 month ago

kofimokome commented 1 month ago

After sending an SMS, check the new user's balance. If it is lower than 2.5, call an endpoint to alert the user. 2.5 should be in an environment variable, LOW_BALANCE_ALERT_THRESHOLD.

The endpoint should also be defined in an environment variable, DC_LOW_BALANCE_ALERT_API or any other name you think is best.

Wrap the API call in a try catch, but do not throw an error in the catch block. Just ignore any error returned by this endpoint.

The API call should be a POST request with the following payload: