This package provides a library for constructing TwiML. Install using
$ cabal install twiml
Documentation is available through GitHub (for HEAD) or Hackage for the current and preceding releases.
For the Twilio REST API, see twilio-haskell.
The following Haskell code
{-# LANGUAGE RebindableSyntax #-}
{-# LANGUAGE RecordWildCards #-}
import Prelude
import Control.Lens
import Data.Default
import Text.XML.Twiml
import qualified Text.XML.Twiml.Syntax as Twiml
example :: VoiceTwiml
example =
voiceResponse $ do
say "Hello, world" $ def & voice .~ Man
hangup
where Twiml.Syntax{..} = def
is transformed into
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say voice="man">Hello, world</Say>
<Hangup/>
</Response>
Feel free to contribute to any of the open issues,
bugfixes, etc. When you think you're ready to merge, ensure the tests are
passing and open a pull request. If you are adding new functionality, please
include new tests as well. Finally, add yourself to the AUTHORS
file.