ebs.callActionByNameAsync
(FintechOS Studio 20.2 and later)
Asynchronously calls by name an internal endpoint set up on the FintechOS platform. The result of the operation is returned in a promise object.
Syntax
Copy
ebs.callActionByNameAsync(endpointName: string, data: any): Promise<any>
| Parameter | Description |
|---|---|
endpointName
|
The name of the endpoint you wish to access |
|
|
Key-value pairs of any input parameters to be passed to the internal endpoint in JSON format. |
Result
The promise result indicates the result of the code execution, depending on the endpoint's function. Some of the result keys are listed below:
| Key | Description |
|---|---|
Message
|
Indicates the outcome of the call. |
IsSuccess
|
Indicates if the call insert was successful. |
Copy
{
"UIResult": {
"NavigateToEntityPage": false,
"NavigateToEntityPageOnEdit": false,
"NavigateToEntityFormName": null,
"NavigateToEntityName": null,
"NavigateToEntityId": null,
"NavigateToEntityInsertDefaults": null,
"NavigateToUrl": null,
"DownloadFile": null,
"ReloadPage": false,
"Message": "some stuff",
"IsSuccess": false,
"Data": null,
"NavigateToPageNo": null
},
"Message": null,
"IsSuccess": true,
"ClientScript": null,
"Serialized": "{\"UIResult\":{\"NavigateToEntityPage\":false,\"NavigateToEntityPageOnEdit\":false,\"NavigateToEntityFormName\":null,\"NavigateToEntityName\":null,\"NavigateToEntityId\":null,\"NavigateToEntityInsertDefaults\":null,\"NavigateToUrl\":null,\"DownloadFile\":null,\"ReloadPage\":false,\"Message\":\"some stuff\",\"IsSuccess\":false,\"Data\":null,\"NavigateToPageNo\":null},\"Message\":null,\"IsSuccess\":true,\"ClientScript\":null,\"Serialized\":null,\"ErrorCode\":0}",
"ErrorCode": 0
}
Examples
In this example:
- We send to the chatbot endpoint the following question: To be or not to be?
- If the call is successful, we log the Question received message in the console. Otherwise, we log the Could not understand question message.
Copy
ebs.callActionByNameAsync('chatbot', {inputMessage: 'To be or not to be?'})
.then(function(result) {
if (result.IsSuccess == true)
console.log('Question received')
else
console.log('Could not understand question')
})