Skip to content

MoceanAPI/mocean-grails-sms

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Mocean SMS Grails Plugin

Description

This plugin provide sending SMS capability to grails framework for user using MoceanAPI service

Try for FREE now. 20 trial SMS credits will be given upon registration. Additional SMS credits can be requested and is subject to approval by MoceanAPI

Configuration

Add your credentials to your application.yml like sample below.

moceanapi:
    api_key: YOUR_MOCEAN_API_KEY
    api_secret: YOUR_MOCEAN_API_SECRET

Add dependencies

dependencies {
    ...
    compile "org.grails.plugins:mocean-grails-sms:0.0.1"
}

Add repo

repositories {
    ...
	maven { url "http://dl.bintray.com/moceanapi/plugins" }
}

Usage

Normal:

If you only need send SMS can follow the sample below.

import com.moceanapi.sms.SmsService

class Testing {

    def SmsService
    
    def index() { 
       
        def from = "SENDER_NUMBER"
        def to = "RECEIVER_NUMBER"
        def text = "MESSAGE_BODY"
        Map response = SmsService.send(from, to, text)
    }
}

Advance:

If you wish to have more configuration options to your SMS. Please visit our API docs to find out more parameters

import com.moceanapi.sms.SmsService

class Testing {

    def SmsService
    
    def index() { 
       
        Map map = ["mocean-from": "SENDER", "mocean-to": "RECEIVER", "mocean-text": "MESSAGE_BODY"]
        Map response = SmsService.send(map)
    }
}