Details on the webhook key and payload?

Hello fellow squids,
I’m setting up some webhooks in order to automate my organisation’s workflow.
In the guide to formatting, there is an example of a payload, which includes the following line:

if ( ... ) {
return "I just uploaded a large image ${event.fileName}";
} else { ...

but I can’t see “fileName” in the list right above the example, which contains the information that can be integrated from the enriched event, so I am confused about how to use the payload, and the paragraph about template strings doesn’t clear it up either…
Question: To be very verbose, what exactly should I put in the payload field, in order to return all entries from a specific schema? If my app name is “morning-gazette” and the schema name is “article”, would this be correct syntax, or what would be?

return ${ 'morning-gazette/article' }

Furthermore, the description of the shared secret is a bit confusing. The hint states that “the shared secret is used to calculate the signature” but doesn’t specify what method of calculation is used.
Question: How is the signature calculated from the secret (in this example case “securekey”)?

You are right, a lot of room for improvements of the docs.

I have updated the docs to include the information about the share secret.

The payload field can be used to define a custom payload, but you can leave it empty to get the full event.

In case you need a custom payload you have two options:

You can either enter a script that returns a javascript object, e.g. something like

Script(
   return {
       message: `content is create by ${event.user.name}`
   }
)

or the same as simple string template

{
   "message": "content is created by $USER_NAME"
}
1 Like