Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
WebHook.Create
Creates a new web hook object.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
WebHook | 11.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
none
Result
Returns reference number or error.
Description
Creates a new web hook object.Please call WebHook.Release later to free it.
You can decide whether you want your web hook always answer the same answer with auto answering (defaults to HTTP 200 OK as response) or whether you like to disable that, keep connection open and answer the query in a timely manner in the scripts. But if FileMaker is busy, you may be too late (2 minutes usually) and the connection is already timed out.
Examples
Start a normal HTTP Webhook:
Set Variable [ $$WebHooks ; Value: MBS("WebHook.Create") ]
Set Variable [ $r ; Value: MBS("WebHook.Listen"; $$WebHooks; 9999) ]
Set Variable [ $r ; Value: MBS("WebHook.SetScript"; $$WebHooks; Get(FileName); "WebHookReceived") ]
Start a SSL HTTP Webhook:
Set Variable [ $$WebHooks ; Value: MBS("WebHook.Create") ]
Set Variable [ $r ; Value: MBS("WebHook.SetSSL"; $$WebHooks; "/Users/cs/WebHook/certificate.crt"; "/Users/cs/WebHook/private_key.pem") ]
Set Variable [ $r ; Value: MBS("WebHook.Listen"; $$WebHooks; 9999) ]
Set Variable [ $r ; Value: MBS("WebHook.SetScript"; $$WebHooks; Get(FileName); "WebHookReceived") ]
Start a RAW hook:
If [ IsEmpty ( $$WebHooks ) ]
Set Variable [ $$WebHooks ; Value: MBS("WebHook.Create") ]
#
# enable keep open and disable auto answer, so we can send custom answer
Set Variable [ $r ; Value: MBS("WebHook.SetAutoAnswer"; $$Webhooks; ""; "UTF-8") ]
Set Variable [ $r ; Value: MBS("WebHook.SetMode"; $$WebHooks; 2+1) ]
#
Set Variable [ $r ; Value: MBS("WebHook.Listen"; $$WebHooks; WebHook::Server Port) ]
Set Variable [ $r ; Value: MBS("WebHook.SetScript"; $$WebHooks; Get(FileName); "WebHookReceived With RAW Mode") ]
Set Field [ WebHook::Server Webhook ; $$WebHooks ]
End If
See also
- WebHook.List
- WebHook.Listen
- WebHook.Release
- WebHook.SetAutoAnswer
- WebHook.SetMode
- WebHook.SetScript
- WebHook.SetSSL
- WebView.Create
Example Databases
- CURL/Email/Office 365 oAuth SMTP
- WebHook/Trigger script with Webhook/WebHook Listener
- WebHook/WebHook Chat/WebHook Chat
- WebHook/WebHook to serve html
- WebHook/WebHook
Blog Entries
This function checks for a license.
Created 13th October 2021, last changed 18th October 2021