 
 	if word?
 		data.trigger_word = word
+
+	sendMessage = (message) ->
+		user = RocketChat.models.Users.findOneByUsername(trigger.username)
+
+		message.bot =
+			i: trigger._id
+
+		defaultValues =
+			alias: trigger.alias
+			avatar: trigger.avatar
+			emoji: trigger.emoji
+
+		if room.t is 'd'
+			defaultValues.channel = '@'+room._id
+		else
+			defaultValues.channel = '#'+room._id
+
+		message = processWebhookMessage message, user, defaultValues
+
 
 	opts =
 		params: {}

					return RocketChat.API.v1.failure 'error-running-script'


			if not result?.data?.text? and not result?.data?.attachments?
				return

			user = RocketChat.models.Users.findOneByUsername(trigger.username)

			result.data.bot =
				i: trigger._id

			defaultValues =
				alias: trigger.alias
				avatar: trigger.avatar
				emoji: trigger.emoji

			if room.t is 'd'
				defaultValues.channel = '@'+room._id
			else
				defaultValues.channel = '#'+room._id

			message = processWebhookMessage result.data, user, defaultValues


ExecuteTrigger = (trigger, message, room) ->

			vmScript.runInNewContext sandbox
			opts = sandbox.result
			console.log 'result', opts
			if opts.message?
				return sendMessage opts.message
		catch e
			console.error "[Error running Script:]"
			console.error script.replace(/^/gm, '  ')
