Edit an IBM Cloud Function action
Introduction
Use the proceeding steps to edit the IBM Cloud Function action that you created to include the sample code that is provided as part of the Git repository.
For information about how to invoke your action or any troubleshooting issues that you encounter, see Troubleshooting.
Edit actions
Copy the content from each of the sample actions to your newly created actions.
Edit the caseworker action
The following steps outline how to edit the caseworker action:
From
Functions
>Actions
>curam-rest
package, select thecaseworker
action.From the left navigation section, select
Code
.Copy the content of the
caseworker.js
and paste it into the code section.Click
Save
.From the left navigation section, select
Endpoints
, selectEnable as Web Action
and clickSave
.Copy the URL under Web Actions.
Go back to the
Code
section, and update the value for thecfEndpoint
const to paste the value of the URL.Remove the
caseworker.json
at the end. For example:https://eu-gb.functions.appdomain.cloud/api/v1/web/<name>ie.ibm.com_org_dev/curam-rest/Click
Save
.
Edit the person and verifications actions
The following steps outline how to edit the person and verifications actions:
From
Functions
>Actions
>curam-rest
package, select theperson
action.From the left navigation section, select
Code
.Copy the content of the
person.js
and paste it into the code section.Update the value for the
env
const to point to your environment. For example:https://<server-name>Click
Save
.From the left navigation section, select
Endpoints
, selectEnable as Web Action
and clickSave
.To edit the
verifications
action by using the content from theverifications.js
, repeat the steps.
Customizing an action
If you want to customize one of the sample actions, or add your own action, you may need to take the following information into account:
- The
caseworker
action is the entry point into the actions, and is what gets invoked from Watson Assistant. It determines which other underlying actions to call. If you add a new lower level action, you will need to update thecaseworker
action to call your new action and pass along any required parameters. - If you create a new action which calls to a REST API in SPM, you will need to ensure you add the authorization and referer headers to the API request.
Details of how to retrieve the value for the authorization header from the webhook and pass along through the actions and to the REST API may be copied from the sample code. The referer header should be set to a value of
curam://<name>
. - The sample code does not send an accept-language header when calling the REST API in SPM, and so the default fallback of
en
will be used by the API. If you require the REST API to return attributes that contain localizable text in another language or locale, you can update the sample code to add an accept-langauge header to the API request.