Categories:
Aura bridge supports several WhatsApp numbers
Description of the process for the configuration of Aura, so Aura bridge can support several WhatsApp channels
Introduction
aura-bridge is able to support different WhatsApp numbers, treating each of them as a different Aura channel. For example, it will be possible to have several numbers at the same time and with the support of the same bridge.
From Aura’s point of view, we would consider these numbers as different channels: they can be configured to all intents and purposes as different channels.
Communication flow
Request flow of a message to aura-groot from a web container or native app:
sequenceDiagram whatsapp ->> Kernel: 1002 request whatsapp ->> Kernel: 1004 request Kernel ->> bridge: request + apiKey + channelId Note right of bridge: get openId data for this channelId bridge ->> aura: request + channelId aura ->> bridge: response + channelId bridge ->> Kernel: response + accessToken Kernel ->> whatsapp: response to 1002 Kernel ->> whatsapp: response to 1004
Properties of the channel
The WhatsApp channel must have the following fields in its configuration, defined in the WhatsApp client model, within Aura channel model:
"channel_id": "<channel_id>", // Contains the UUID that identifies the channel univocally in Aura.
...,
"whatsapp": {
"client": {
"id": "<id>", // authorization ID with Kernel whatsapp client.
"secret": "<secret>", // authorization secret with Kernel whatsapp client
"purposes": "<purposes>", // authorization purposes with Kernel whatsapp client
"scopes": "<scopes>" // authorization scopes with Kernel whatsapp client
}
},
....
Set the webhook
The last step is to tell Kernel which is the callback of the service where Aura will process the WhatsApp requests. So, in this case, we must set as webhook the WhatsApp messages endpoint of aura-bridge.
An example request is shown below:
# substitute <aura-services-domain> with the domain of your environment, usually something like svc-es-pro
# substitute <api-key> with an APIKey generated
# substitute <channelId> with an whatsapp channel identifier
$ curl -i -X PATCH -H "Authorization: Bearer $TOKEN" -H 'content-type: application/json' -H 'x-correlator: $CORRELATOR' 'https://api.global-int-current.baikalplatform.com/whatsapp/v1/settings/webhook' -d '{"webhooks": {"url": "https://<aura-services-domain>.auracognitive.com/aura-services/v1/whatsapp/messages?apikey=<api_key>&channelId=<channel_id>"}}'
HTTP/2 201
{"webhooks": {"url": "https://<aura-services-domain>.auracognitive.com/aura-services/v1/whatsapp/messages?apikey=<api_key>&channelId=<channel_id>"}}
It is not needed that the endpoint is up and running to set it as webhook.
Further information of Kernel APIs for WhatsApp: https://developers.baikalplatform.com/apis/whatsapp/1.0.0/#operation/Update-Webhooks
Detailed information for WhatsApp activation.