License | MIT |
---|---|
Maintainer | kaiko@zazler.com |
Safe Haskell | None |
Language | Haskell98 |
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
- data Delivery
- = Delivered SmsID
- | DeliveryError SmsID Int String
- | DeliveryProgress SmsID String
- data MessenteError
- send :: String -> String -> Maybe String -> String -> String -> IO (Either (Int, String) SmsID)
- listen :: Int -> (Delivery -> IO ()) -> IO ()
- verify :: String -> String -> SmsID -> IO Delivery
Documentation
Delivered SmsID | Happy final state |
DeliveryError SmsID Int String | Negative final state |
DeliveryProgress SmsID String | Not final state. Informative report. |
data MessenteError Source
Exceptions for Messente API
WrongCredentials | |
InvalidIP | |
InvalidParameters [(String, String)] | |
InvalidSender String | |
MissingPin | |
ServersDown | All servers gave |
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