dev-resources.site
for different kinds of informations.
Recreate shopify webhooks
Published at
9/10/2024
Categories
ruby
rails
shopify
webhook
Author
ugifractal
Author
10 person written this
ugifractal
open
When developing custom Shopify apps, I usually use ngrok as a reverse proxy for webhooks integration. Since I always use a free service plan from Ngrok, then the URL address always changes. Here is the sample generated Ngrok URL when running
ngrok http 3000
Generated endpoint
https://73d3-2001-448a-3032-c93e-bc56-f800-e58d-8a98.ngrok-free.app
When we hit ctrl+c
and rerun the command, we will get a different new URL.
So what I did was just change the .env
file of my Rails project, go to console, and recreate Shopify webhooks.
bundle exec rails c
Shop.first.recreate_webhooks!
And here is the code for recreate_webhooks!
# app/models/shop.rb
Ā def recreate_webhooks!
Ā Ā ShopifyAPI::Webhook.all.each do |webhook|
Ā Ā Ā webhook.destroy
Ā Ā end
Ā Ā ShopifyApp.configuration.webhooks.each do |item|
Ā Ā Ā webhook = ShopifyAPI::Webhook.new(item)
Ā Ā Ā if webhook.save
Ā Ā Ā Ā puts "webhook #{item} created."
Ā Ā Ā else
Ā Ā Ā Ā puts "webhook #{item} failed."
Ā Ā Ā end
Ā Ā end
Ā end
So every time you need to regenerate webhooks, you can just run this method from rails console
.
webhook Article's
30 articles in total
Integrating MongoDB Atlas Alerts with Lark Custom Bot via AWS Lambda
read article
Replay failed stripe events via webhook
read article
Integrating Stripe Payment Intent in NestJS with Webhook Handling
read article
Designing a webhook service: A practical guide to event-driven architecture.
read article
Creating a user interface for the Webhook module using Angular
read article
Recreate shopify webhooks
currently reading
Creating a configurable Webhook module for a NestJS application
read article
Forward SMS to Webhook with iPhone Shortcut Automations
read article
Understanding Webhooks: How to Handle Them in Your Application
read article
Building a community database with GitHub : A guide to Webhook and API integration with hono.js
read article
O Que SĆ£o Webhooks e Como UtilizĆ”-los Eficientemente
read article
Simplifying Webhook Handling with Vector.dev: A Modern Solution for Serverless Apps
read article
Creating a Websocket server in Hono with Durable Objects
read article
Efficient Webhook Handling in Laravel Using Unique Jobs
read article
WhatsApp webhook API types
read article
Post Reddit posts on Instagram with a simple like on Discord. You will love Webhooks! šŖ
read article
Manage Telegram Webhooks Using curl
read article
Bootstrapping Cloudflare Workers app with oak framework & routing controller
read article
Webhook Security Approaches
read article
Handling Eventual Consistency in Webhook
read article
Sending GitHub Secrets to Docker Apps on VMs Using adnanh/webhooks
read article
Troubleshooting 5xx errors with your Stripe Webhook
read article
LemonSqueezy Webhooks for Non-Auth Users in Laravel
read article
How to use the new Symfony Maker command to work with GitHub Webhooks
read article
Webhooks: A Mindset Change for Batch Jobs
read article
Trigger Jenkins builds with Github Webhook Using Smee Client
read article
How to Setup Webhook in Google Form?
read article
Ngrok: Exposing local server on the internet
read article
Custom Header in Stripe Webhook Payload
read article
Mengenal Webhook, API Tanpa Polling
read article
Featured ones: