Call a Linked Service
Linked services are invoked from the assistant's client-side actions — a form wired to the proxy, or a custom template action — using the executeProxyRequest helper:
executeProxyRequest(id, body, callback, params)
id— the Service ID you registered.body— the JSON payload to send. It's used as the request body forPOSTandPUT;
GET and DELETE requests are sent without a body.
callback— receives the endpoint's response so your action can render it.params(optional) — values that fill{{params.x}}placeholders in the service's URL and
headers. See Pass dynamic values.
From a Form
For a form whose purpose is to call an endpoint, wire its submit to sendProxyForm, which serializes the fields and calls executeProxyRequest for you:
sendProxyForm(proxyId, event, callback)
Pass the Service ID as proxyId. The submitted fields become the request body, and the response is appended to the conversation. See Assistant forms for building the form and Advanced customization for wiring its handler.
From a Custom Action
In a custom template helper you can call executeProxyRequest(id, body, callback) directly — for example to fetch data when the user clicks a button — and use the response to update the conversation. The helper is documented under Advanced customization.
Related Docs
- Advanced customization — helpers, actions and templates.
- Assistant forms — capture the input a service call needs.