messente-0.1.0.1: Messente SMS Gateway

LicenseMIT
Maintainerkaiko@zazler.com
Safe HaskellNone
LanguageHaskell98

Messente

Description

Example

import Messente

smsSend = send "api-username" "api-password"
main = do
  result <- smsSend Nothing "+00000000000" "my first sms"
  putStrLn $ case result of
    Right id -> "sms sent, id: " ++ id
    Left (errNo, errStr) -> "not sent: " ++ show errNo ++ ", " ++ errStr

  listen 9000 delivery

delivery :: Delivery -> IO ()
delivery del = putStrLn $
  case del of
    Delivered id  -> "delivered " ++ id
    DeliveryError id errNo errStr -> "not delivered " ++ id ++ ": " ++ errStr
    DeliveryProgress id status    -> "progress "      ++ id ++ ": " ++ status

Synopsis

Documentation

data Delivery Source

Constructors

Delivered SmsID

Happy final state

DeliveryError SmsID Int String

Negative final state

DeliveryProgress SmsID String

Not final state. Informative report.

Instances

data MessenteError Source

Exceptions for Messente API

Constructors

WrongCredentials 
InvalidIP 
InvalidParameters [(String, String)] 
InvalidSender String 
MissingPin 
ServersDown

All servers gave FAILED 209

Unknown String

Just in case. Argument contains http response as it is.

send :: String -> String -> Maybe String -> String -> String -> IO (Either (Int, String) SmsID) Source

Sends sms and returns Either error or sms id It takes arguments apiUser apiPassword from to content

listen :: Int -> (Delivery -> IO ()) -> IO () Source

Listens delivery reports Takes port number and callback function as arguments.

verify :: String -> String -> SmsID -> IO Delivery Source

Verify SMS delivery. Takes apiUser apiPassword smsId