Cloudkibo / KiboPush

0 stars 1 forks source link

Test webhooks feature #10096

Closed ImranBinShoukat closed 4 years ago

ImranBinShoukat commented 4 years ago

This task is to test the webhooks feature and all of the events that can be sent. Also, comment here about each of the events. What the event is and when it will be sent to webhook url.

sojharo commented 4 years ago

I have looked into this feature and it is not working for now. I was able to add the webhook URL of my test server. KiboPush also verified our URL to check if it is authentic URL or not.

I, then, added the events that I want to get on my test server. However, I didn't receive these events. Any change might have broken the feature. This feature was developed in 2018 around September and August.

I have seen that we have discussion document for this feature at following link:

https://docs.google.com/document/d/1bTeDF762uLm3VTiuramKcnrVKNqd9QoZBq2B7PbLJ-o/edit?pli=1#heading=h.rgqn0pbi182z

Also, we had written a blog post about this in following issue. This blogpost is not published and we need to publish it again:

https://github.com/Cloudkibo/KiboPush/issues/3400

We also have the documentation for this feature available on our website which I think needs to be updated as it is not telling the consumer developer what data or payload they should expect from us.

https://kibopush.com/webhooks/

We had initially created this feature for clicky to demonstrate how on checkbox plugin (installed on their website), their system can receive webhook events from us.

Webhook Events

Here are the types of events that we can subscribe to: (and I think few of them are not very important and we can replace them with new events from kibochat depending on customer's requirements)

new poll webhook event

This event will be sent to given webhook URL whenever a new poll is created on KiboPush. I think we don't need it much and can be hidden to make space for other useful events in our UI.

poll response webhook event

This event will be sent to given webhook URL whenever any poll has received response on messenger from subscriber. I think we don't need it much and can be hidden to make space for other useful events in our UI.

new survey webhook event

This event will be sent to given webhook URL whenever a new survey is created on KiboPush. I think we don't need it much and can be hidden to make space for other useful events in our UI.

survey response webhook event

This event will be sent to given webhook URL whenever any survey question has received response on messenger from subscriber. I think we don't need it much and can be hidden to make space for other useful events in our UI.

new subscriber webhook event

This event will be sent to given webhook URL whenever a new subscriber is created. This will send subscriber information to other system. This can be very helpful in cases when customer wants to receive subscriber information inside their CRM pushed by KiboPush.

live chat actions webhook event

This event will be sent to given webhook URL whenever a new message from subscriber is sent to the page. This can be helpful in case when customer wants to receive all the chat in their system and they want it in real-time.

checkbox optin

This event will be sent when a customer has checked the checkbox on any form while filling it. It maybe cart or any other form. This will let KiboPush know which form has been filled by which facebook subscriber and we can send this information to customer server so that it can be used to send updates to customer. This was developed for clicky so that they can get in real-time information when their cart gets filled with facebook subscriber ref id. This ref id which is sent from our server can be used by them to call our api to send order updates to customer.

Payload:

Following is the example of payload that we send to customer server for events. This one is for live chat actions.

         var data = {
             subscription_type: 'LIVE_CHAT_ACTIONS',
             payload: {
               format: 'facebook',
               subscriberId: subscriber.senderId,
               pageId: page.pageId,
               session_id: subscriber._id,
               company_id: page.companyId,
               payload: event.message
             }
           }

We should create a documentation for developers who want to use our webhook subscription service. This documentation should document these above payloads so that developer will know what they should expect from our server.

We should do the following tasks for this feature:

Action Items:

  1. Fix the webhooks feature for all the events
  2. Publish the blog post
  3. Update the documentation on user guide.
  4. Think of what other webhook events we should introduce for our customers (specially Hamza's case)
ImranBinShoukat commented 4 years ago

When we fix the webhooks feature for all events we should send events in the following JSON format:

{
    type: 'new_subscriber/new_chat_message/etc',
    platform: 'facebook/whatsapp/sms',
    payload: object
}

Payload should be set differently for each event and we should also create a document to list down all of the events with their payload.

ImranBinShoukat commented 4 years ago

@sojharo please open all the issues. We will be adding the following events as well:

  1. chatbot_option_selected
  2. session_assigned

Also, add a task to add webhooks feature in billing pricing and mek it only accessible in Premium and Enterprise plan

sojharo commented 4 years ago

Ok.

These are the final tasks that we will open in this webhooks v2 milestone:

  1. Fix the webhooks feature for all the events
  2. Publish the blog post
  3. Update the documentation on user guide.
  4. Update the webhook payload to new payload discussed in issue by imran
  5. add new webhook event: chatbot_option_selected
  6. add new webhook event: session_assigned
  7. Team testing of webhooks v2 feature
  8. Upgrade test cases and setup daily testing for webhooks
sojharo commented 4 years ago

After discussing with @ImranBinShoukat, I have opened all the tasks for this.