WebHook.Listen
--------------

Starts listening for incoming requests on this port.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [WebHook](component_WebHook.md) | [11.5](newinversion115.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "WebHook.Listen"; WebHook; Port { ; Queue Length } ) 

**MBS**( **"WebHook.Listen";** /\* Starts listening for incoming requests on this port. \*/  
**$WebHook**; /\* The reference number of the web hook. \*/   
**$Port**; /\* The port number to use.  
Between 1024 and 65535.  
  
Can be zero to pick random port (since v12.5)e.g. 9999 \*/   
**$Queue Length**) /\* Optional; How many entries the queue should have for waiting connections to process.  
Default is 10.  
Range is from 2 to 100.e.g. 10 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| WebHook | The reference number of the web hook. | $webhook |  |
| Port | The port number to use.   Between 1024 and 65535.      Can be zero to pick random port (since v12.5) | 9999 |  |
| Queue Length | How many entries the queue should have for waiting connections to process.   Default is 10.   Range is from 2 to 100. | 10 | Optional      Added in version **13.1**. |

### Result

Returns OK or error.

### Description

Starts listening for incoming requests on this port.  
You may need to allow incoming connections for FileMaker application in your firewall application.  
  
The queue for incoming connections waiting to be accepted by the plugin is currently 10.  
### Examples

Listen on port 9999:

 Set Variable \[ $r ; Value: MBS ("WebHook.Listen"; $$WebHooks ; 9999) \]  
Listen on new port:

 Set Variable \[ $$WebHooks ; Value: MBS ("[WebHook.Create](WebHookCreate.md)") \]   
Set Field \[ WebHook::Server Webhook ; $$WebHooks \]   
\# ask for new random port   
Set Variable \[ $r ; Value: MBS ("WebHook.Listen"; $$WebHooks ; 0) \]   
\# set trigger script   
Set Variable \[ $r ; Value: MBS ("[WebHook.SetScript](WebHookSetScript.md)"; $$WebHooks ; Get(FileName); "WebHookReceived") \]   
\# query port   
Set Field \[ WebHook::Server Port ; MBS ( "[WebHook.GetPort](WebHookGetPort.md)"; $$WebHooks ) \]  
### See also

- [WebHook.Create](WebHookCreate.md)
- [WebHook.GetPort](WebHookGetPort.md)
- [WebHook.List](WebHookList.md)
- [WebHook.SetMode](WebHookSetMode.md)
- [WebHook.SetScript](WebHookSetScript.md)
- [WebHook.SetSSL](WebHookSetSSL.md)

### Release notes

- **Version 13.1**
    - Added Queue Length parameter for [WebHook.Listen](https://www.mbsplugins.eu/WebHookListen.shtml) function.
- **Version 12.5**
    - Changed [WebHook.Listen](https://www.mbsplugins.eu/WebHookListen.shtml) to allow passing zero as port number to pick a random port, which you then query via [WebHook.GetPort](https://www.mbsplugins.eu/WebHookGetPort.shtml).
- **Version 12.1**
    - Fixed an issue in [WebHook.Listen](https://www.mbsplugins.eu/WebHookListen.shtml) not working on Windows.

### Example Databases

- [CURL/Email/GMail oAuth SMTP](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/GMail%20oAuth%20SMTP.shtml#1ScriptAnchor_)
- [CURL/Email/Office 365 oAuth SMTP](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/Office%20365%20oAuth%20SMTP.shtml#1ScriptAnchor_)
- [WebHook/Trigger script with Webhook/WebHook Listener](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/WebHook/Trigger%20script%20with%20Webhook/WebHook%20Listener.shtml#1ScriptAnchor_)
- [WebHook/WebHook Chat/WebHook Chat](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/WebHook/WebHook%20Chat/WebHook%20Chat.shtml#1ScriptAnchor_)
- [WebHook/WebHook to serve html](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/WebHook/WebHook%20to%20serve%20html.shtml#1ScriptAnchor_)
- [WebHook/WebHook](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/WebHook/WebHook.shtml#1ScriptAnchor_)

### Blog Entries

- [Using Gmail with oAuth2 for SMTP with MBS Plugin](https://www.mbsplugins.de/archive/2025-05-08/Using_Gmail_with_oAuth2_for_SM/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 13.1pr1](https://www.mbsplugins.de/archive/2023-02-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [Trigger Scripts via WebHook](https://www.mbsplugins.de/archive/2022-12-08/Trigger_Scripts_via_WebHook/monkeybreadsoftware_blog_filemaker)
- [SMTP with OAuth for Office 365 in FileMaker](https://www.mbsplugins.de/archive/2022-11-22/SMTP_with_OAuth_for_Office_365/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 12.5pr2](https://www.mbsplugins.de/archive/2022-10-06/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 12.1pr7](https://www.mbsplugins.de/archive/2022-03-10/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [WebHook Introduction](https://www.mbsplugins.de/archive/2021-10-28/WebHook_Introduction/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 13th October 2021 , last changed 24th January 2023

  
[WebHook.List](WebHookList.md) - [WebHook.Release](WebHookRelease.md)

[HTML Version](WebHookListen.shtml)