Frequently asked Questions

The following Pragma Edge Webhooks frequently asked questions and answers provide you with general and frequently used or required installation, configuration, and replication-related information.

Pragma Edge Webhooks

Pragma Edge webhooks (PEW) is a solution for lightweight real-time, Event-driven API. PEW can be thought of as a type of API that is driven by events rather than requests. Instead of one application making a request to another to receive a response, a webhook is a service that allows one program to send data to another as soon as a particular event takes place. With web services becoming increasingly interconnected, webhooks are seeing more action as a lightweight solution for enabling real-time notifications and data.

Read the following PragmaEdge Webhooks frequently asked questions and answers.

Watson Assistant supports the following types of webhooks:

  • Skill-level webhooks
  • Assistant-level webhooks

The skill-level webhook is different from the assistant-level webhooks in the following ways:

  • Frequency with which the webhooks is called
    The dialog webhook is called on the rare occasion that the dialog node from which it is triggered is processed.
    The message processing webhooks are called with every single exchange in a conversation between the customer and the assistant.
    The log webhook is called with each message and its corresponding response.
  • Where the condition is defined
    For a dialog webhook, the condition to meet before an action is taken is defined in the dialog skill. If the node condition is not met, then the dialog webhook is never called.
    For the message processing webhooks, the condition to check for before taking an action must be defined in the external application code. For example, even if your webhook performs a simple language translation, you’d want to use a condition to check the language of the incoming message before sending the text to the translation service.
    You don’t need to define a condition for the log webhook unless you want to filter the messages somehow. In most cases, the goal is to write out every message that is submitted, so the messages can be stored for as long as you want, and analyzed by an external application or service.
  • Where you configure them
    You configure the dialog webhook from the the Options>Webhook page of the dialog skill. You then initialize it from one or more dialog nodes by customizing the node.
    You configure the assistant-level webhooks from the Settings>Webhooks page for the assistant.

To use a webhook from a dialog node, you must enable webhooks on the node, and then add details for the callout.

Click the Dialog tab.

Find the dialog node where you want to add a callout. The callout to the webhook will occur whenever this node is triggered during a conversation with a user.
For example, you might want to send a callout to the webhook from the #General_Greetings node.

Click to open the dialog node, and then click Customize.

Scroll down to the webhook section. Set the Callout to webhooks/actions skill switch to On.

Select Call a webhook, and then click Apply.
If you did not have it enabled already, the Multiple conditioned responses switch is set to On automatically and you cannot disable it. This setting is enabled to support adding different responses depending on the success or failure of the Webhook call. If you had a response specified for the node already, it becomes the first conditional response.

Add any data that you want to pass to the external application as key and value pairs in the Parameters section.
Parameters are passed as request body properties. You cannot specify query parameters or URL parameters in a dialog node. These parameters can only be configired with static values as part of the webhook definition.

Any response made by the callout is saved to the return variable. You can rename the variable that is automatically added to the Return variable field for you. If the callout results in an error, this variable is set to null.
The generated variable name has the syntax webhook_result_n, where the appended _n is incremented each time you add a webhook callout to a dialog node. This naming convention ensures that context variable names are unique across the dialog skill. If you change the name, be sure to use a unique name.

In the conditional responses section, two response conditions are added automatically, one response to show when the webhook callout is successful and a return variable is sent back. And one response to show when the callout fails. You can edit these responses, and add more conditional responses to the node.

  1. If the callout returns a response, and you know the format of the JSON response, then you can edit the dialog node response to include only the section of the response that you want to share with users.

  2. If you want to provide a specific response if the callout returns an empty string, meaning the call is successful, but the value returned is an empty string, you can add a conditional response that has a condition with syntax like this: $webhook_result_1.size() == 0

If you decide you do not want to make a webhook call from a dialog node, open the node’s Customize page, and then switch Webhooks Off.

The Parameters section and the Return variable field are removed from the dialog node editor. However, any conditional responses that were added for you or that you added yourself remain.

The Multiple conditioned responses section is editable again. You can choose to switch the feature off. If you do so, then only the first conditional response is saved as the node’s only text response.

To change the external service that you call from dialog nodes, edit the webhook details defined on the Webhooks page of the Options tab. If the new service expects different parameters to be passed to it, be sure to update any dialog nodes that call it.

You can define one webhook URL to use for preprocessing every incoming message.

The programmatic call to the external service must meet these requirements:

  • The call must be a POST HTTP request.
  • The request body must be a JSON object. 
  • The call must return in 30 seconds or less.

APIs are manual and must be asked to pull or edit data.Webhooks will automatically transmit data as a result of an event, without demand from another program. Webhooks are a subset APIs that are much less restricted than APIs – they can only transmit data.

By using JSON Webhooks you will be able to access real-time weather data from devices like weather sensors vending machines, wearables as well as other.

Webhook triggers can be described as an automated form of trigger which listens for specific type of data like triggers from