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
MBS( "WebHook.Create" )

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

Example Databases

Blog Entries

This function checks for a license.

Created 13th October 2021, last changed 18th October 2021


WebHook.Check - WebHook.GetAutoAnswer

💬 Ask a question or report a problem