Show Navigation


Provides SMS sending capabilities to a Grails application.

Owner: novadge | 0.1.4 | Aug 13, 2016 | Package | Issues | Source | License: Apache-2.0

dependencies {
    compile 'org.grails.plugins:grails-twilio:0.1.4'


Twilio Grails


The twilio-grails plug-in provides sms sending capability to a Grails application via twilio api.


Add your twilio properties to grails configuration file: Example Assuming you have a twilio account, then add the required information to your grails config file.

twilio {
    // Enter your host address
    host = ''
    apiID = 'enter your api Id'
    apiPass = 'enter your api password'
    smsUrl = '/2010-04-01/Accounts/' + apiID + '/Messages.json'
    number = ""


Copy and paste the following to your BuildConfig.groovy File compile(group:'org.apache.httpcomponents',name:'httpclient',version:'4.3.6') compile(group:'org.apache.httpcomponents',name:'fluent-hc',version:'4.3.6') compile(group:'org.apache.httpcomponents',name:'httpclient-cache',version:'4.3.6') compile(group:'org.apache.httpcomponents',name:'httpmime',version:'4.3.6')


Inject smsService into your class

def smsService

smsService is a Grails service that provides a method called send() that can take mapped parameters. Please note that 'send()' is overloaded 'see' and can take various variations of parameters.

One simple form is: send(Map map)

Where ......

map contains parameters... phone number of recipient eg +1234444444

map.from: your twilio assigned number eg. +09899898989

map.body: "The body of your message" map.mediaUrl: "Url for any attachment" (optional )


An example usage can be seen below.

Class YourController{
    def smsService
    def yourMethod(){
        def map = [to:"070987878787",from:"09808000000",body:"SMS BODY"]