Instant - Kaleyra Provider Setup
On this page |
|---|
Overview
FROM VERSION 3.34.0
Kaleyra can be integrated as a WhatsApp provider to send and receive messages through the WhatsApp channel. It supports both inbound messages and outbound campaigns via templates.
For detailed Kaleyra documentation, refer to the official guide: https://developers.kaleyra.io/docs/whatsapp-overview
Requirements
You must create an account on http://Kaleyra.io, by following the official guide: https://developers.kaleyra.io/docs/create-an-account-in-kcloud
You need to register your WhatsApp-enabled phone number on http://eu.kaleyra.io
You have to generate an API Key, as outlined in the next section.
Configuration
API Key Manager
Navigate to Developers > API Keys in the Kaleyra dashboard.
You can:
View an existing API Key by clicking the three-dot menu > View, or
Generate a new API Key
By clicking on 3 dots of an existed API Key → View, make note of the following required fields details: API Domain, SID and API Key. These are necessary for integrating Kaleyra with your WhatsApp account.
Register your phone number
To register a phone number:
Log in to the Kaleyra dashboard.
Navigate to Channels > WhatsApp Configuration > Manage.
Under the Configurations tab, find your registered number or add a new one.
Click the three-dot menu > Edit to access the following details:
Phone number
WABA ID, required for the account setup
Incoming URL – paste here your Receive URL copied from your WhatsApp account
Callback profile ID – required to receive message and template status updates
To whitelist the Receive URL:
Go to your Kaleyra profile dropdown list → Settings
Click Edit Details under Enable WhatsApp Callback URLs
Add the same Receive URL to the whitelist (so the URL is enabled the receipt of messages):
Callback profiles
To enable message delivery and template status updates, configure two callback profiles:
a. Incoming Messages Callback
Go to your profile dropdown → Callback Profiles
Click Add New
Configure the following profile for the receipt of messages:
a mandatory title: insert e.g.
LOCAL_INCOMINGChannel API: select Default
HTTP Method: insert POST
Endpoint: indicate the Receive URL, so the URL at which the callback information should be received
Request Body (Dynamic Variables): insert this object published by Kaleyra:
{ "message": "<message>","mime_type": "<mime_type>", "media_url": "<media_url>", "from": "<from>", "name": "<name>", "type": "<type>", "created_at": "<created_at>" }Click on Save
This callback profile becomes active immediately
b. Template Status Updates Callback
This profile may take some time to become active.
Add a second callback profile to receive updates about templates status with:
Title: insert e.g.
LOCAL_TEMPLATEChannel API: select Default
HTTP Method: insert
POSTEndpoint:
https://yourmotionserver/api/whatsapp/template-messages/status/update
Request Body (Dynamic Variables):
{ "id": "<id>", "time": "<time>","event": "<event>", "message_template_id": "<message_template_id>", "message_template_name": "<message_template_name>", "message_template_language": "<message_template_language>", "reason": "<reason>","callback_profile_id": "<callback_profile_id>", "company_id": "<company_id>" }
So when a new template is created, it remains in pending status. When it is approved/rejected, the update status is sent to the indicated endpoint.
Creation of WhatsApp Account on XCALLY
To create a new WhatsApp account in XCALLY:
Go to WhatsApp Channel > Accounts
Click Add Account and provide the following:
Name: custom name for the account
Key: unique identifier
List of contact manager to associate contacts
Proxy or Motion domain
Type: Kaleyra
Base URL: from API Keys > View > API Domain
WhatsApp Business Account ID: From Configurations tab > Created number > Edit > WABA ID
Account SID: from API Keys > View > SID
API Key: from API Keys > View > API Key
Phone Number: from Configurations > Created number > Edit > Phone Number
Templates creation
On Motion account
Go to WhatsApp Templates section
Filter by Provider: Kaleyra and optionally by Account
View templates with their category and status
You can create a new template, by following the relative documentation at this link
Templates cannot be edited in Motion for Kaleyra, but you can edit it on Kaleyra template section.
If a template is rejected, you can create a new one in Motion or you can edit it directly on Kaleyra. In this case template approval is subject to Kaleyra review process.
On Kaleyra account
Navigate to Channels > WhatsApp > Configurations > Templates
Use the three-dot menu to view or Edit a template
Deletion is not supported via Kaleyra UI – deleted templates remain visible. So you can delete them only from Motion database but they remain on Kaleyra account.
You can edit all parameters, except name and template category
Obviously you can also add new templates, by clicking on Add template
When creating or editing a template, provide:
Header Text also in Sample Header Text
Body Content also in Sample Body Content (replace variables with static values. Templates without sample fields filled will be rejected by the system).