Feature Request - Webhook response options

You can send an email from FM and ask the user to click a url to acknowledge or accept something.

That url can be an Otto webhook with value pairs like:
&available=yes&user=xyz123&event=12345.
This is then available in OttoReceiver. This in itself is great.

A downside is that the user is taken to a webpage with something like
{“success”:true,“scriptError”:0,“scriptResult”:{“success”:true},“messageRecordId”:“11”,“successMessage”:“Message Accepted”}.

For each webhook (with a successful scriptResult) could we determine the response, in the Webhook section in Otto?

  1. the default JSON (application/json)
  2. text string (text/plain)
  3. simple html (text/html)
  4. html form with a submit button.

These could just be fields with static responses.
Next level would be combining it with fm data relating to the initial webhook/OttoReceiver trigger.

Hey @amallo ,

The response from webhooks is fully customizable via the webhook script response. This can be used to send back simple JSON or build fully customized HTTP responses.

For your various requirements:

  1. just send back the JSON response
  2. send back a JSON response with the following structure:
{
  "useScriptResult": true,
  "status": 200,
  "statusMessage": "OK",
  "headers": { "Content-Type": "text/plain" },
  "body": "this is a plain text response"
}

3 and 4. send a 307 response to redirect the user to your html page. add some query params if you want to send data along with them:

{
  "useScriptResult": true,
  "status": 307,
  "statusMessage": "OK",
  "headers": { "Location": "https://my.server.url/fill-out-this-form" }
}

Then you can fully customize the contents of the strings and forms based on data from your solution based on data in the HTTP response. Does that work for your use case?

-Kyle

2 Likes

Kyle, Sorry I missed that help page on ‘webhook script response’. That will probably do it. Could you add your response examples to that help page?

Yeah I can add a couple more examples to that page.

-Kyle

So could 3&4 return (with FM data) a html page from C:\Program Files\FileMaker\FileMaker Server\HTTPServer\conf\…

Examples have been added to the docs page.

And yes, you could put an HTML page into the FMS HTTP folder and just redirect there. You’d need to send along data you want to display in the URL most likely unless you want to build data fetching into the HTML page.

-Kyle