In Previous post I have explained how to create the ConnectorID, Connection Secrete and the Access Token in Kaizala, which would be required when you need to use Kaizala APIs for integrations. You should have saved these strings in notepad for further reference or need to visit the page again to refer these.
Let us understand what are Kaizala APIs and how to use those.
Please refer the below Microsoft Docs link for more details
In order to understand the Kaizala APIs schemas and play around it you can import postman collection including sample and schemas for all Kaizala APIs. After importing the Kaizala APIs your Postman screen would look like below screenshot. The Kaizaa APIs would listed in the left frame
As you an see in the above screen shot, it has 52 requests categorised in 5 different groups such as
- Authentication
- Group Management
- Content Creation APIs
- Content Query APIs
- Subscription APIs (webhooks)
These APIs cover most of the functionality which can be managed in Kaizala portal.
Now let us go through each of the groups in details and see how to use those in integrations.
Before you start any activity, it is important that you get authenticated. APIs under Authentication are used for the same.
Generate PIN : Generate PIN is the API used to generate PIN to connect to your Kaizala instance from your mobile Refer below screenshot.
{{api-root}}/v1/generatePin – {{api-root}} should be replaced by api.kaiza.la.
It expects two parameters as
- Content-Type – application/json
- postman-token- Enter the access token generated in previous steps of creating the connectors
Under the Body section you can see below string. Mobile number and application ID placeholders should be filled with actual phone number and connectorID which you have received in earlier step of creating connector
{“mobileNumber”:”{{mobile-number}}”, applicationId:”{{application-id}}”}
Once you enter all details and click on send, it would send the 4 digit PIN to the mentioned mobile number.
To call this API from .Net code, you can click on the Code link and see c# code . Same code can be used in any console application or web service.
You can see the code generated in below screenshot
Now next step is Login with pin and applicationID to get the refreshToken
Login with pin and applicationID to get the refreshToken
In this step you need pass the mobile number, applicationID and pin which is generated in the previous step
This would generate the refreshToken
You need to copy the refreshToken and go to next step.
Note:
- AccessToken is valid for 24 hours (Hence you need to get fresh access token before doing any action in Kaizala)
- RefreshToken is valid for 365 days
You should always import latest KPIs as I have observed Kaizala team keeps enhancing these KPIs and there are chances that you would get better functionality with latest APIs.
As you have seen Postman provides you the code in C# which can be used in the web services and you can consume these web services in your business applications.
Let us look at a simple scenario on how I can connect to Kaizala from Dynamics 356 Customer Engagement.
For example: Whenever I create an opportunity in CRM, I want to send a survey to a group of people in Kaizala and track the responses back in terms of activities against the same opportunity.
The above scenario would consist of two interfaces
- Create an action from CRM in Kaizala
- Get response back from Kaizala to CRM on real time
I will explain the technical details in my next blog
Keep reading and happy connecting 🙂
Continue reading “Kaizala – How to integrate with business applications?- Part 2”