Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 11.3   11.4   11.5   12.0   12.1   12.2   12.3   12.4   12.5   13.0    Statistic    FMM    Blog  

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

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


WebHook.Check - WebHook.GetAutoAnswer

Feedback: Report problem or ask question.


Start Chat