Webhooks
Creating a webhook
Section titled “Creating a webhook”var service = new WebhookService(myShopifyUrl, shopAccessToken);Webhook hook = new Webhook(){ Address = "https://my.webhook.url.com/path", CreatedAt = DateTime.Now, Fields = new List<string>() { "field1", "field2" }, Format = "json", MetafieldNamespaces = new List<string>() { "metafield1", "metafield2" }, Topic = "app/uninstalled",};
hook = await service.CreateAsync(hook);Retrieving a webhook
Section titled “Retrieving a webhook”var service = new WebhookService(myShopifyUrl, shopAccessToken);var webhook = await service.GetAsync(webhookId);Updating a webhook
Section titled “Updating a webhook”var service = new WebhookService(myShopifyUrl, shopAccessToken);var webhook = await service.UpdateAsync(webhookId, new Webhook(){ Address = "https://my.webhook.url.com/new/path});Deleting a webhook
Section titled “Deleting a webhook”var service = new WebhookService(myShopifyUrl, shopAccessToken);
await service.DeleteAsync(webhookId);Counting webhooks
Section titled “Counting webhooks”var service = new WebhookService(myShopifyUrl, shopAccessToken);int webhookCount = await service.CountAsync();Listing webhooks
Section titled “Listing webhooks”var service = new WebhookService(myShopifyUrl, shopAccessToken);IEnumerable<Webhook> webhooks = await service.ListAsync();