[Script] Send notification via Boxcar2 API

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
rpluto
Posts: 4
Joined: 29 Apr 2014, 12:04

[Script] Send notification via Boxcar2 API

Post by rpluto »

Send notification via Boxcar2 API

Code: Select all

import org.jsoup.Jsoup
import org.jsoup.Connection.Method

// print input parameters
_args.bindings?.each{ _log.finer('Parameter: ' + [it.key, it.key =~ /|pushbullet|gmail|mailto|myepisodes/ ? '*****' : it.value].join(' = ')) }
args.each{ _log.finer("Argument: $it") }

def BoxCarNotification(title,text){
		def boxcar2AccessToken   = "put your boxcar2 access token"
		def page = Jsoup
			.connect('https://new.boxcar.io/api/notifications')
			.data("user_credentials", boxcar2AccessToken, "notification[title]", title, "notification[long_message]", text, "notification[sound]", "bird-1" )
			.method(Method.POST)
			.ignoreHttpErrors(true)
			.ignoreContentType(true)
			.followRedirects(true)
			.execute()
	}

def title      = tryQuietly{ title.toString() }
def text      = tryQuietly{ text.toString() }
BoxCarNotification(title,text)

More about API

https://boxcar.uservoice.com/knowledgeb ... tification
Post Reply