Development
Define the logic of what needs to happen when your action is activated
The onEvent
function is called whenever orchestration or design (preview) activates a Custom Action. It will publish a message that is received by the extension server, which automatically finds the right Custom Action and calls the onEvent
function defined in that action.
The onEvent
function has a couple of parameters that will be useful when developing an extension:
onComplete
or onError
function.01
The payload allows you to access the values of your extension settings, action fields, and patient data.
01
The onComplete
callback can be called to confirm your activity has been completed and can be called with the following (optional) parameters:
01
Important: If you do not call the onComplete
function, the activity will not be completed by the extension server. However, the activity can still be completed elsewhere (e.g. Awell Hosted Pages) by calling the completeExtensionActivity
mutation.
The onError
callback can be called to let Awell know something went wrong with running your extension code.
An activity that calls onError
will still be completed, however the "resolution" of the activity will be marked as "failed".
The function can be called with the following (optional) parameter:
01
The helpers object contains useful functions that can be used in your extension. The following functions are available:
A function returns an https agent that can be used to make requests to external APIs using the mTLS protocol.
01
A promise that resolves to the Awell SDK. The Awell SDK can be used to interact with the Awell API using an API key from your tenant. If you do not already have an API key, calling this function will generate one for you.
01
Have an idea for something to make your extension-building life easier? Let us know!