Azure / Commercial-Marketplace-SaaS-Accelerator

A reference example with sample code for developers interested publishing transactable, Software as a-Service offers in the Microsoft commercial marketplace.
MIT License
200 stars 294 forks source link

Setup Webhook #618

Closed NareshkumarBT closed 10 months ago

NareshkumarBT commented 11 months ago

I went through the webhook implementation video(https://www.youtube.com/watch?v=higEi441t1Q). An azure function is created and getting the JSON response. Using the JSON response do we need to save the subscription details in Subscriptions table ?

Is there any other way to implement? Could someone please give detailed explanation on setting up Webhook?

Or

Is that enough if we insert a record in ApplicationConfiguration table with name as WebNotificationUrl and value as webhook url ?

NareshkumarBT commented 11 months ago

any update on this please?

NareshkumarBT commented 11 months ago

Hi @santhoshb-msft

Could you please help me here?

Im getting internal server error after adding the webhook url in applicationconfiguration table.

santhoshb-msft commented 11 months ago

@NareshkumarBT i think there are few questions here. Implementing external web notification is an optional feature to connect to your other systems if needed. Can you explain more when you say you are getting an error. You mean after adding and removing it, you are getting an error?

NareshkumarBT commented 11 months ago

Hi @santhoshb-msft

I noticed below points after publishing the customer portal.

  1. When we configure the Saas Offer from marketplace, it is redirecting to landing page with Subscription details and Subscribe button.
  2. When we click on Subscribe button, it is taking more time(app 40 secs) and navigating to process page(below screenshot).
  3. I see in the Subscribe click, internally calling webhook post method and it is taking time.

Please suggest me, how to avoid the time and please let me know what actions to be taken.

image

Thanks in advance.

santhoshb-msft commented 11 months ago

@NareshkumarBT can you try removing your web external link if you re not using it?

NareshkumarBT commented 11 months ago

@santhoshb-msft I'm using that webnotification link(https://demo-saas-portal.azurewebsites.net/api/AzureWebhook) to get webhook notifications. I added the url in ApplicationConfiguration table

santhoshb-msft commented 11 months ago

@NareshkumarBT no thats not correct. You should use this link in your offer technical configuration. External Web Notification feature in the App Config is a completely different feature used for different purpose. For more information on what an External Web Notification feature is please review here. https://microsoft.github.io/Mastering-the-Marketplace/saas-accelerator/#using-the-external-notification-feature

NareshkumarBT commented 11 months ago

@santhoshb-msft

When customer click on subscribe, using external web notification url the action is taken to external endpoint to take actions accordingly. Using webhook, if the customer is already activated Saas offer and if there is any change plan or unsubscribe the action is taken to external endpoint.

My question here is, if i remove the web notification url how the webhook will hit the external endpoint and receive notification? What change do we need to do for webhook notification ?

santhoshb-msft commented 10 months ago

@NareshkumarBT - Webhhook is different to ExternalWebNotification.

Webhook - is already part of the Accelerator customer site app, which you will use in your offer technical configuration, and you will receive notification from Marketplace on any customer changes are described here.

ExternalWebNotificaion is a different, additional, optional feature if you would like to further forward the above received notifications to your other systems.

To start with, does this distinction help?

santhoshb-msft commented 10 months ago

@NareshkumarBT hope the above clarifies, if not please feel free to reopen with further questions. closing this for now.

BayScallop commented 6 months ago

I don't know if you can help and I see this is closed, but I am having an issue where the (Azure Marketplace) WebHook I created never receives a notification from the Azure Marketplace. I have followed the patterns in the docs and can hit the webhook API's with Postman and monitor the WebHook in the Azure Logs. The WebHook is an Azure SaaS service. I have opened a case with Microsoft Partner Center but they cannot seem to provide any answers. This is the last item I need to complete before submitting my offer for certification. I can provision and activate a test subscription from the Landing Page but when I make changes in the Azure SaaS Dashboard, no webhook call occurs. I figure it is either: 1) blocked at the network level (don't think so as it is public); 2) Saas service is not in a correct state to send WebHook messages (I can activate a test subscription); 3) Issue with endpoint (I have tired several as the docs and online postings have several variations) and I don't see any attempts to any endpoint - generally a bad endpoint shows a 404 in the logs. So the most likely is item 2 unless I am totally missing something.