initial
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<cfcomponent
|
||||
displayname="Notifier"
|
||||
output="true"
|
||||
hint="Notification helper, to be refactored">
|
||||
|
||||
<!---Внимание! необходимо зарегистрировать на сервере сертификат хоста maker.ifttt.com, иначе SSL соединение не установится и будет Connection Failure--->
|
||||
<!--- Нужно реализовывать нормальную систему с подпиской на события, по типу
|
||||
https://tonytruong.net/event-emitter-pattern-in-coldfusion/--->
|
||||
|
||||
<cffunction name="notify"
|
||||
access="public"
|
||||
returntype="any"
|
||||
output="false"
|
||||
hint="send notification">
|
||||
|
||||
<cfargument name="value1" type="string" required="true" />
|
||||
<cfargument name="value2" type="string" required="true" />
|
||||
<cfargument name="value3" type="string" required="true" />
|
||||
|
||||
<cftry>
|
||||
<cfhttp name="ifttt" method="post" url="https://maker.ifttt.com/trigger/mms_task_event/with/key/drWn5g6pNjyP_XRru0tMrQ" result="resp" timeout="10">
|
||||
<cfhttpparam type="header" name="Content-Type" value="application/json" />
|
||||
<cfhttpparam type="body" value="#serializeJSON(arguments)#">
|
||||
</cfhttp>
|
||||
<cfreturn resp.filecontent/>
|
||||
<cfcatch type="ANY">
|
||||
<cfreturn "#cfcatch.message# #cfcatch.detail#"/>
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
|
||||
</cffunction>
|
||||
|
||||
</cfcomponent>
|
||||
Reference in New Issue
Block a user