在 Haskell 中使用 Twilio 轻松发送短信:


{-# LANGUAGE OverloadedStrings #-}

import Control.Monad.Trans.Maybe

import Twilio



main :: IO ()

main = let u = User \"Your Twilio User ID\" \"Your Twilio Auth Secret\"

            send = sendMessage u

            message = \"Boo\"

            from = \"+18001234567\"

            to = \"+19001234567\"

        in do

            status <- runMaybeT $ send $ SMS from to message

            putStrLn (show status)

代码通过 Twilio API 发送短信,可以通过修改 User IDAuth Secret 来实现个性化的发送。