Categories:
Bridge utils
Bridge utils is a utility found in Aura Bot common library to manage aura-bridge
Introduction
Bridge utils utility includes methods for managing aura-bridge.
Find more information in the Github repository: https://github.com/Telefonica/aura-common-utilities/tree/master/packages/aura-bot-utilities/src/aura-bot-common/utils
It contains different methods, described in the following sections.
getAsyncCallbackUrl
This method is used for use cases that use asynchronous APIs and have to send a callback URL. It builds the URL with the parameters expected by the end point of aura-bridge, which will be the one that receives the event.
This returns the URL to send as callback parameter.
function getAsyncCallbackUrl(context: TurnContext,
configuration: Configuration, callbackId?: string, apiKeyHeader: boolean = false): string
| param | type | description | mandatory |
|---|---|---|---|
| context | TurnContext | Context where the channel data will be taken from | yes |
| configuration | Configuration | Environment configuration | yes |
| callbackId | string | Request identifier | no |
| apiKeyHeader | boolean | Flag to indicate if APIKey is in header (true) or as parameter (false). By default, true |
no |
Example of use:
const callbackUrl = getAsyncCallbackUrl(stepContext.context, this.configuration, callbackId);
getAsyncCallbackUrlDataEncrypt
This method builds the URL with the parameters expected by the endpoint for async-callbacks in aura-bridge.
function getAsyncCallbackUrlDataEncrypt(auraId: string, channelId: string, conversationId: string, corr: string, configuration: Configuration, version: string, messageId: string, callbackId?: string, apiKeyHeader: boolean = false): string
| param | type | description | mandatory |
|---|---|---|---|
| auraId | string | Aura identifier | yes |
| channelId | string | Channel identifier | yes |
| conversationId | string | Conversation identifier | yes |
| corr | string | Correlator | yes |
| configuration | Configuration | Environment configuration | yes |
| version | string | Request version | yes |
| messageId | string | Original request version | yes |
| callbackId | string | Request identifier | no |
| apiKeyHeader | boolean | Flag to indicate if APIKey is in header (true) or as parameter (false). By default, true |
no |
Example of use:
const callbackUrl = getAsyncCallbackUrlDataEncript( auraId, channelId, conversationId, corr, configuration, version, messageId, callbackId, true);