Web Hooks

Read/Write Fields

The following Fields can be Read and Written To. These Fields can be used to load data from Blueprints etc.
They can also be included referred to in Calculations or in Templates.

Field *requiredTitleTypeDetails
Name *Webhook NametextMaximum length – 100 characters
RecordTypeNameRecord TyperecordtypeThe Record Type on which this Webhook operates e.g. Person / Organisation / a custom RecordType. Note that this has no technical effect on the processing of the calls to this Webhook – it is simply a convenience to manage your Webhook records against RecordTypes. Most (not necessarily all) Webhooks relate primarily to a particular RecordType in your PYXI application.
URLURLurlOptional full http/https URL that will be called. If left blank then the WebhookURL from the attached DataSource will be used by default. If set, then this overrides any default set on the DataSource.
The value stored in this field will be evaluated as a template, so may contain calculations. Typically, this may be used to refer to persistent settings for part of the URL e.g. {getsetting(“WebHookRoot”)}webhook.php where the persistent setting WebHookRoot has already been set to a suitable value e.g. http://myapp.com/webhooks/
DataSourceData SourceDataSourceAn optional reference to a DataSource. This is a convenience to allow you to keep track of all WebHooks that are associated with a particular external application.
isEnabledEnabled?logicalWebHook calls are only allowed to this WebHook if this flag is set. If you are experiencing any problems with your WebHook, you should turn off this flag until the problem is fixed, ensuring that no further attempts are made to call the webhook url.
HeaderScriptHeader ScriptactionscriptAn optional Script used to generate HTTP headers. This Script is evaluated on the record linked to the WebhookCall. The return value of the script should be an array – each element of the array will be turned into an HTTP header with the same name as the array element. The OutboundAPIKey value on the DataSource record linked to this Webhook is made available to the script as the variable apikey. This helps facilitate the common use-case where you need to pass the APIKey as an Http Header
E.g.
SET headers.myAPIKey = apikey RETURN headers

Will result in an HTTP Header called myAPIKey with the value stored in DataSource:OutboundAPIKey
BodyScriptBody ScriptactionscriptA Script used to generate the body of the call, typically being a JSON array. This Script is evaluated on the record linked to the WebhookCall. The return value of the script should be an array which will be passed on the Webhook call in JSON format. Any (optional) InputParams provided to the call, typically passed in the callWebhook() function, will be available to the script as the variable input. E.g.
# Fields from the Linked Record SET body.recordid = ID SET body.firstname = FirstName # Values from the input params SET body.mytext = input.mytext RETURN body

Will result in a JSON array similar to {“recordid”:12345678,”firstname”:”Bob”,”mytext”:”whatever passed in inputParams.mytext”}
ActionScriptAction Script (on Success)actionscriptThis optional Action Script is evaluated on the record linked to the WebhookCall when the Webhook response is received, if the call is successful. The response, if any, is available to the script in a variable called response. Assuming that the response is a JSON array or object, individual values can be utilised with standard dot syntax e.g. response.payload.name
ActionScriptOnFailAction Script (on Fail)actionscriptThis optional Action Script is evaluated on the record linked to the WebhookCall when the Webhook response is received, IF the call fails. You should normally expect that there is no valid response packet from the Webhook call – use cases for this ActionScript might include updating a status message on the owning record to indicate to users that an expected process is not going to happen due to the call failure. Note that if you do this, it is essential to consider clearing that status message on successful calls otherwise an inappropriate message may linger on the owning record if the call succeeds on retry or is later fixed.

Read-Only Fields

The following Fields can be Read only. They can be referred to in Calculations or in Templates.

FieldTitleType
StatusTextStatustext
LastCallTimeLast Call Timedatetime
LastResponseCodeLast Response Codenumber
WebhookCallsCallslist
CreatedCreateddatetime
CreatedByCreated ByPerson
UpdatedUpdateddatetime
UpdatedByUpdated ByPerson

Get Started