Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
WebHook.SetAutoAnswer
Sets auto answer text.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
WebHook | 11.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
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. |
"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 function if needed.
Can be set to empty text if you plan to use WebHook.SetMode and WebRequest.Send 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"; $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"; $Answer; 3 ) ]
Set Variable [ $AnswerLength ; Value: Length(MBS( "Text.EncodeToHex"; $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: " & $AnswerLength & "¶¶" & $Answer ]
Set Variable [ $Text ; Value: MBS( "Text.ReplaceNewline"; $Text; 3 ) ]
Set Variable [ $r ; Value: MBS("WebHook.SetAutoAnswer"; WebHook::Server Webhook; $Text; "UTF-8") ]
See also
- Text.EncodeToHex
- Text.ReplaceNewline
- WebHook.Create
- WebHook.GetAutoAnswer
- WebHook.SetMode
- WebRequest.Send
Example Databases
- CURL/Email/Office 365 oAuth SMTP
- WebHook/Trigger script with Webhook/WebHook Listener
- WebHook/WebHook to serve html
- WebHook/WebHook
Blog Entries
This function checks for a license.
Created 17th October 2021, last changed 13th October 2022