Kaizala – How to integrate with business applications – Dynamics CRM – part4

I am sure that you have understood how we can call the Kaizala APIs from dynamics CRM along with the webhook concept to get the response from Kaizala on real-time.

As we move further, let us see actual usage of webhook in Kaizala and Dynamics CRM integration. Kaizala provides multiple webhook subscriptions such as

postman webhook

As shown in above screenshot, at the moment Kaizala provides three webhooks/ subscription APIs

  • Subscribe to all events at group level
  • Subscribe to all events at action level
  • Subscribe to all events at action level with action package id

We can subscribe to any of the above APis based on the  requirement. Let us see how to use”Subscribe to all events at group level” webhook. Below is the code we can see in the body of this subscription in Postman. If we read this, it is quite intutve.

{
“objectId”:”{{test-group-id}}”,
“objectType”:”Group”,
“eventTypes”:[
“ActionCreated”,
“ActionResponse”,
“SurveyCreated”,
“JobCreated”,
“SurveyResponse”,
“JobResponse”,
“TextMessageCreated”,
“AttachmentCreated”,
“Announcement”,
“MemberAdded”,
“MemberRemoved”,
“GroupAdded”,
“GroupRemoved”
],
“callBackUrl”:”https://requestb.in/12786un1″,
“callBackToken”:”tokenToBeVerifiedByCallback”,
“callBackContext”:”Any data which is required to be returned in callback. Current webhook data can be seen by refreshing: https://requestb.in/12786un1?inspect”
}

You have to pass the groupID for which you need to get the response. You need to keep the events on which you need a response from Kaizala. If you need response  only  when the survey is responded by anybody, then just keep the “SurveyResponse” event and remove rest of the events. If you keep the unwanted events, you would get the response for each and every event unnecessarily.

You need to replace the callbackUrl with your Url which would be registered in the Kaizala for posting the response. To test the response, you can just register the same Url and try to respond to the survey. This would post the survey response to this url and you can see the output which would get by accessing the Url.

Kaizala would post a Json file containing the data of the response and you need to access this Json file and  get the content as required by your integration.For e,g  you can store these details in Dynamics CRM or create new entity and track the responses etc.

You can view all the webhooks registered for the group by using the API “Get all webhooks” on a group and if required even unsubscribe the registered webhook by using “Unsubscribing a webhook”

we have come to end of the integration series. I am still working on how to create custom actions in Kaizala. I would share my finding about the same in my further posts.

Kindly comment in case you want me to write on something specific on the Kaizala integration, I would definitely try to respond to your comments.

Hit the like button/ follow my blog / share my blog  if you like the content.

Keep reading my blog to know more about latest Microsoft SaaS products. Continue reading “Kaizala – How to integrate with business applications – Dynamics CRM – part4”

What is Webhook?

We must understand the concept of webhook as most of the websites provide webhooks to subscribe their events.

When I heard this concept for the first time, I was amazed and really wondering how to actually use it. Then  I researched on it and found the concept interesting and would like to share the same with you.

Let us look at a scenario in real life. you have to pick up someone who has gone for a live concert and not sure when the concert would be over. You are calling that person around the estimated time and asking after every 10 mins if the concert is over and he/she should be picked up. Here instead of you calling that person again and again, you both mutually decide that  the person will call you once the concert is over and then you will come and pick up.  This is like call me up once done :). This is exactly what webhook does.

The Wikipedia definition of webhook is

“A webhook in web development is a method of augmenting or altering the behavior of a web page, or web application, with custom callbacks. These callbacks may be maintained, modified, and managed by third-party users and developers who may not necessarily be affiliated with the originating website or application. The term “webhook” was coined by Jeff Lindsay in 2007 from the computer programming term hook.[1]

Most of us are familiar with the word API which stands for Application Programming Interface. Whenever we need data or  any functionality, we call the APIs and get  required data such as find the good restaurants in this area. We use APIs to send the survey. However when we need real-time response when anyone responds to the survey, our program cannot keep calling the API frequently and check if there is any response. Instead of doing this tiresome job, we register the webhook and it informs us whenever there is any response.

Webhook is HTTP call back and it shares the data whenever it is available.

Similar concept is used in Kaizala or many other websites to provide us the response. We need to register web URL with their service and whenever event happens it would post the data to your url. Now it is up to you what you want to with this data.Most of webhooks I have come across, post the data in the form of  JSON format.

You can just create an event handler, host it on Azure and register its url to the webhook.

Please go through the below link for webhook reference.

https://www.chargebee.com/blog/what-are-webhooks-explained/

In my next blog let us see how to use the webhook in Kaizala and get the survey response on real time.

Thank you for reading for my blog. Please comment and share if you like if you find the write up useful.