WebHook.SetAutoAnswer
---------------------

Sets auto answer text.

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

MBS( "WebHook.SetAutoAnswer"; WebHook; Text { ; Encoding } ) 

**MBS**( **"WebHook.SetAutoAnswer";** /\* Sets auto answer text. \*/  
**$WebHook**; /\* The reference number of the web hook. \*/   
**$Text**; /\* The text to send out.  
Should use CRLF as line endings and end with two CRLF. \*/   
**$Encoding**) /\* Optional; The text encoding for result.   
Default is UTF-8.e.g. "UTF8" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| WebHook | The reference number of the web hook. | $webhook |  |
| Text | The text to send out.   Should use CRLF as line endings and end with two CRLF. |  |  |
| Encoding | The text encoding for result.    Default is UTF-8.   Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the [FAQ](https://www.monkeybreadsoftware.com/filemaker/faq.shtml). | "UTF8" | Optional |

### Result

Returns OK or error.

### Description

Sets auto answer text.  
This is the http response we send out for a request.  
We send out a text like this by default:  
  
HTTP/1.1 200 OK  
Server: MBS Plugin  
Connection: close  
Content-Length: 0  
  
Line endings must be CRLF, so please use [Text.ReplaceNewLine](TextReplaceNewLine.md) function if needed.  
Can be set to empty text if you plan to use [WebHook.SetMode](WebHookSetMode.md) and [WebRequest.Send](WebRequestSend.md) functions.  
### Examples

Set auto answer:

 Set Variable \[ $text ; Value: "HTTP/1.1 201 Created¶Server: MyServer 1.0 ¶Connection: close¶Content-Length: 0¶¶" \]   
Set Variable \[ $text ; Value: MBS ( "[Text.ReplaceNewLine](TextReplaceNewLine.md)"; $Text ; 3 ) \]   
Set Variable \[ $r ; Value: MBS ("WebHook.SetAutoAnswer"; WebHook::Server Webhook; $text ; "UTF-8") \]  
Clear auto answer:

 Set Variable \[ $r ; Value: MBS ("WebHook.SetAutoAnswer"; $Webhook ; "") \]  
Set auto answer with some text:

 Set Variable \[ $Answer ; Value: "Your request was received. Thank you.¶" \]   
\# we need to know lenght of text in UTF-8, so we convert to hex to measure.   
Set Variable \[ $Answer ; Value: MBS ( "[Text.ReplaceNewLine](TextReplaceNewLine.md)"; $Answer ; 3 ) \]   
Set Variable \[ $AnswerLength ; Value: Length(MBS ( "[Text.EncodeToHex](TextEncodeToHex.md)"; $Answer ; "UTF-8")) / 2 \]   
\# now we build the http request   
Set Variable \[ $Text ; Value: "HTTP/1.1 201 Created¶Server: MyServer 1.0 ¶Connection: close¶Content-Length: " &amp; $AnswerLength &amp; "¶¶" &amp; $Answer \]   
Set Variable \[ $Text ; Value: MBS ( "[Text.ReplaceNewLine](TextReplaceNewLine.md)"; $Text ; 3 ) \]   
Set Variable \[ $r ; Value: MBS ("WebHook.SetAutoAnswer"; WebHook::Server Webhook; $Text ; "UTF-8") \]  
### See also

- [Text.EncodeToHex](TextEncodeToHex.md)
- [Text.ReplaceNewLine](TextReplaceNewLine.md)
- [WebHook.Create](WebHookCreate.md)
- [WebHook.GetAutoAnswer](WebHookGetAutoAnswer.md)
- [WebHook.SetMode](WebHookSetMode.md)
- [WebRequest.Send](WebRequestSend.md)

### 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 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#4ScriptAnchor_)

### 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)
- [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)
- [WebHook Introduction](https://www.mbsplugins.de/archive/2021-10-28/WebHook_Introduction/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 17th October 2021 , last changed 13th October 2022

  
[WebHook.Release](WebHookRelease.md) - [WebHook.SetMaximumRequestSize](WebHookSetMaximumRequestSize.md)

[HTML Version](WebHookSetAutoAnswer.shtml)