
What is Shopify?
Nowadays e-commerce is using more and if you want to set up your online store then as a quick setup and solution Shopify will come in mind. It allows to sell merchants to their own products even it is physical or digital products. With Shopify merchants can build there own brands to be sold on their name rather than online shopping platforms like Amazon, eBay, Flipkart, and more. Shopify is reducing the time of store setup as well as it brings less interaction with a technical person so cost saving will be also managing with fast store setup.
What is Shopify Apps?
As you all know Shopify is built with Ruby on Rails. so it is better to create Shopify apps with ruby on rails. Shopify Apps will be used in any Shopify store as a plugin where merchants want to enhance their store in terms of functionality. They don’t need an extra technical team to build the functionality of what they needed and save time. They can use existing Shopify Apps from the Shopify App store and if they want any private apps then also merchant will create with help of Shopify App Development team.
How to create Shopify Apps with Ruby On Rails?

To create the Shopify app, you need to follow these steps
Create a Shopify Partner account
Once you create that, you will need to create a custom Shopify app within the partner dashboard
Setup URLs within the app. Here local machine URL like localhost will not work so you need ngrok or another tunneling software like ssh, localtunnel, and more.
App URL: “https://{your domain}”
Redirection URL: “https://{your_domain}/auth/shopify/callback”
Get the API key and API secret key from the app.
SSL certificate is required if you are using your own domain after deployment on the server. (Make sure you use https://)
Now let’s create Ruby On Rails application and integrate Shopify app gem within it for create Shopify apps
Create a new rails application with
$ rails <span class="token keyword keyword-new" style="box-sizing: border-box; color: rgb(0, 119, 170);">new</span> my_shopify_app
$ rails <span class="token keyword keyword-new" style="box-sizing: border-box; color: rgb(0, 119, 170);">new</span> my_shopify_app
$ rails <span class="token keyword keyword-new" style="box-sizing: border-box; color: rgb(0, 119, 170);">new</span> my_shopify_app
Then open the Gemfile and add Shopify app gem into it
$ gem <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">'shopify_app'</span></span
$ gem <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">'shopify_app'</span></span
$ gem <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">'shopify_app'</span></span
Then install the gem with a
$ bundle install
$ bundle install
$ bundle install
This gem includes default generators like install, shop, and home controller.
This is the recommended way to start a new app from scratch:
$ rails generate shopify_app
$ rails generate shopify_app
$ rails generate shopify_app
After generating generators, add new tables in the database with the command
$ rake db<span class="token symbol" style="box-sizing: border-box; color: rgb(153, 0, 85);">:migrate</span
$ rake db<span class="token symbol" style="box-sizing: border-box; color: rgb(153, 0, 85);">:migrate</span
$ rake db<span class="token symbol" style="box-sizing: border-box; color: rgb(153, 0, 85);">:migrate</span
After that setup API key and API Secret into the rails app. Set both keys as an environment variable and add this in shopify_app.rb file:
ShopifyApp<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>configure <span class="token keyword keyword-do" style="box-sizing: border-box; color: rgb(0, 119, 170);">do</span> <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">|</span>config<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">|</span> config<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>application_name <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">"Example app"</span></span> config<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>api_key <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token constant" style="box-sizing: border-box; color: rgb(153, 0, 85);">ENV</span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">[</span><span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">'SHOPIFY_APP_API_KEY'</span></span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">]</span> config<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>secret <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token constant" style="box-sizing: border-box; color: rgb(153, 0, 85);">ENV</span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">[</span><span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">'SHOPIFY_APP_SECRET'</span></span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">]</span> config<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>scope <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">"read_products, read_orders, read_customers, write_customers, read_orders"</span></span> config<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>embedded_app <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token boolean" style="box-sizing: border-box; color: rgb(153, 0, 85);">true</span> config<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>after_authenticate_job <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token boolean" style="box-sizing: border-box; color: rgb(153, 0, 85);">false</span> <span class="token keyword keyword-end" style="box-sizing: border-box; color: rgb(0, 119, 170);">end</span
ShopifyApp<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>configure <span class="token keyword keyword-do" style="box-sizing: border-box; color: rgb(0, 119, 170);">do</span> <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">|</span>config<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">|</span> config<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>application_name <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">"Example app"</span></span> config<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>api_key <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token constant" style="box-sizing: border-box; color: rgb(153, 0, 85);">ENV</span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">[</span><span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">'SHOPIFY_APP_API_KEY'</span></span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">]</span> config<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>secret <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token constant" style="box-sizing: border-box; color: rgb(153, 0, 85);">ENV</span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">[</span><span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">'SHOPIFY_APP_SECRET'</span></span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">]</span> config<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>scope <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">"read_products, read_orders, read_customers, write_customers, read_orders"</span></span> config<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>embedded_app <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token boolean" style="box-sizing: border-box; color: rgb(153, 0, 85);">true</span> config<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>after_authenticate_job <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token boolean" style="box-sizing: border-box; color: rgb(153, 0, 85);">false</span> <span class="token keyword keyword-end" style="box-sizing: border-box; color: rgb(0, 119, 170);">end</span
ShopifyApp<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>configure <span class="token keyword keyword-do" style="box-sizing: border-box; color: rgb(0, 119, 170);">do</span> <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">|</span>config<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">|</span> config<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>application_name <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">"Example app"</span></span> config<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>api_key <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token constant" style="box-sizing: border-box; color: rgb(153, 0, 85);">ENV</span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">[</span><span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">'SHOPIFY_APP_API_KEY'</span></span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">]</span> config<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>secret <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token constant" style="box-sizing: border-box; color: rgb(153, 0, 85);">ENV</span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">[</span><span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">'SHOPIFY_APP_SECRET'</span></span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">]</span> config<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>scope <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">"read_products, read_orders, read_customers, write_customers, read_orders"</span></span> config<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>embedded_app <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token boolean" style="box-sizing: border-box; color: rgb(153, 0, 85);">true</span> config<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>after_authenticate_job <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token boolean" style="box-sizing: border-box; color: rgb(153, 0, 85);">false</span> <span class="token keyword keyword-end" style="box-sizing: border-box; color: rgb(0, 119, 170);">end</span
here,
if you don’t want your app embedded with Shopify then make
config<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>embedded_app <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token boolean" style="box-sizing: border-box; color: rgb(153, 0, 85);">false</span
config<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>embedded_app <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token boolean" style="box-sizing: border-box; color: rgb(153, 0, 85);">false</span
config<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>embedded_app <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token boolean" style="box-sizing: border-box; color: rgb(153, 0, 85);">false</span
scope means whatever permission you need from Shopify to get access data into Shopify apps. Make sure you can ask only that permission which you needed.
You can install this app on your store with URL which you have created with tunnel link(ngrok or other which you have used) after starting rails server with rails s
It will ask for shop_domain where you want to install this app like this. So enter your shop domain and install the app.
dded with Shopify then make

Now you can enjoy your Shopify app and play with that with different products, customers, orders, theme customization, etc.
During the installation of the app into your store, you can create some default webhooks as well which you needed in your app using Shopify API.
You just need to add this snippet into shopify_app.rb file
ShopifyApp<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>configure <span class="token keyword keyword-do" style="box-sizing: border-box; color: rgb(0, 119, 170);">do</span> <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">|</span>config<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">|</span> Config<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>application_name <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> “Example app” … topics <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">%w[app/uninstalled orders/create orders/delete]</span></span> config<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>webhooks <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> topics<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>each_with_object<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">(</span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">[</span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">]</span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">)</span> <span class="token keyword keyword-do" style="box-sizing: border-box; color: rgb(0, 119, 170);">do</span> <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">|</span>topic<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">,</span> a<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">|</span> options <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">{</span> topic<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">:</span> topic<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">,</span> format<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">:</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">"json"</span></span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">,</span> address<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">:</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">"https://</span><span class="token interpolation" style="box-sizing: border-box;"><span class="token delimiter punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">#{</span><span class="token content" style="box-sizing: border-box;">your_domain</span><span class="token delimiter punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">}</span></span><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">/webhooks/</span><span class="token interpolation" style="box-sizing: border-box;"><span class="token delimiter punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">#{</span><span class="token content" style="box-sizing: border-box;">topic<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>parameterize<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">(</span><span class="token symbol" style="box-sizing: border-box; color: rgb(153, 0, 85);">separator</span><span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">:</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">'_'</span></span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">)</span></span><span class="token delimiter punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">}</span></span><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">"</span></span> <span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">}</span> <span class="token keyword keyword-end" style="box-sizing: border-box; color: rgb(0, 119, 170);">end</span
ShopifyApp<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>configure <span class="token keyword keyword-do" style="box-sizing: border-box; color: rgb(0, 119, 170);">do</span> <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">|</span>config<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">|</span> Config<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>application_name <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> “Example app” … topics <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">%w[app/uninstalled orders/create orders/delete]</span></span> config<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>webhooks <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> topics<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>each_with_object<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">(</span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">[</span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">]</span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">)</span> <span class="token keyword keyword-do" style="box-sizing: border-box; color: rgb(0, 119, 170);">do</span> <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">|</span>topic<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">,</span> a<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">|</span> options <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">{</span> topic<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">:</span> topic<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">,</span> format<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">:</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">"json"</span></span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">,</span> address<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">:</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">"https://</span><span class="token interpolation" style="box-sizing: border-box;"><span class="token delimiter punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">#{</span><span class="token content" style="box-sizing: border-box;">your_domain</span><span class="token delimiter punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">}</span></span><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">/webhooks/</span><span class="token interpolation" style="box-sizing: border-box;"><span class="token delimiter punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">#{</span><span class="token content" style="box-sizing: border-box;">topic<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>parameterize<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">(</span><span class="token symbol" style="box-sizing: border-box; color: rgb(153, 0, 85);">separator</span><span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">:</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">'_'</span></span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">)</span></span><span class="token delimiter punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">}</span></span><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">"</span></span> <span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">}</span> <span class="token keyword keyword-end" style="box-sizing: border-box; color: rgb(0, 119, 170);">end</span
ShopifyApp<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>configure <span class="token keyword keyword-do" style="box-sizing: border-box; color: rgb(0, 119, 170);">do</span> <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">|</span>config<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">|</span> Config<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>application_name <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> “Example app” … topics <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">%w[app/uninstalled orders/create orders/delete]</span></span> config<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>webhooks <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> topics<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>each_with_object<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">(</span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">[</span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">]</span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">)</span> <span class="token keyword keyword-do" style="box-sizing: border-box; color: rgb(0, 119, 170);">do</span> <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">|</span>topic<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">,</span> a<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">|</span> options <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">{</span> topic<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">:</span> topic<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">,</span> format<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">:</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">"json"</span></span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">,</span> address<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">:</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">"https://</span><span class="token interpolation" style="box-sizing: border-box;"><span class="token delimiter punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">#{</span><span class="token content" style="box-sizing: border-box;">your_domain</span><span class="token delimiter punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">}</span></span><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">/webhooks/</span><span class="token interpolation" style="box-sizing: border-box;"><span class="token delimiter punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">#{</span><span class="token content" style="box-sizing: border-box;">topic<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>parameterize<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">(</span><span class="token symbol" style="box-sizing: border-box; color: rgb(153, 0, 85);">separator</span><span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">:</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">'_'</span></span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">)</span></span><span class="token delimiter punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">}</span></span><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">"</span></span> <span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">}</span> <span class="token keyword keyword-end" style="box-sizing: border-box; color: rgb(0, 119, 170);">end</span
If you don’t want to create a default webhook while app installs, then you can use this code to create webhooks within code anywhere.
topics <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">%w[app/uninstalled orders/create orders/delete]</span></span> shop<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>with_shopify_session <span class="token keyword keyword-do" style="box-sizing: border-box; color: rgb(0, 119, 170);">do</span> topics<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span><span class="token keyword keyword-each" style="box-sizing: border-box; color: rgb(0, 119, 170);">each</span> <span class="token keyword keyword-do" style="box-sizing: border-box; color: rgb(0, 119, 170);">do</span> <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">|</span>topic<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">|</span> ShopifyAPI<span class="token double-colon punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">::</span>Webhook<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>create<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">(</span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">{</span> topic<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">:</span> topic<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">,</span> format<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">:</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">"json"</span></span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">,</span> address<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">:</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">"https://</span><span class="token interpolation" style="box-sizing: border-box;"><span class="token delimiter punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">#{</span><span class="token content" style="box-sizing: border-box;">your_domain</span><span class="token delimiter punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">}</span></span><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">/webhooks/</span><span class="token interpolation" style="box-sizing: border-box;"><span class="token delimiter punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">#{</span><span class="token content" style="box-sizing: border-box;">topic<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>parameterize<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">(</span><span class="token symbol" style="box-sizing: border-box; color: rgb(153, 0, 85);">separator</span><span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">:</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">'_'</span></span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">)</span></span><span class="token delimiter punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">}</span></span><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">"</span></span> <span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">}</span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">)</span> <span class="token keyword keyword-end" style="box-sizing: border-box; color: rgb(0, 119, 170);">end</span> <span class="token keyword keyword-end" style="box-sizing: border-box; color: rgb(0, 119, 170);">end</span
topics <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">%w[app/uninstalled orders/create orders/delete]</span></span> shop<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>with_shopify_session <span class="token keyword keyword-do" style="box-sizing: border-box; color: rgb(0, 119, 170);">do</span> topics<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span><span class="token keyword keyword-each" style="box-sizing: border-box; color: rgb(0, 119, 170);">each</span> <span class="token keyword keyword-do" style="box-sizing: border-box; color: rgb(0, 119, 170);">do</span> <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">|</span>topic<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">|</span> ShopifyAPI<span class="token double-colon punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">::</span>Webhook<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>create<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">(</span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">{</span> topic<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">:</span> topic<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">,</span> format<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">:</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">"json"</span></span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">,</span> address<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">:</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">"https://</span><span class="token interpolation" style="box-sizing: border-box;"><span class="token delimiter punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">#{</span><span class="token content" style="box-sizing: border-box;">your_domain</span><span class="token delimiter punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">}</span></span><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">/webhooks/</span><span class="token interpolation" style="box-sizing: border-box;"><span class="token delimiter punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">#{</span><span class="token content" style="box-sizing: border-box;">topic<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>parameterize<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">(</span><span class="token symbol" style="box-sizing: border-box; color: rgb(153, 0, 85);">separator</span><span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">:</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">'_'</span></span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">)</span></span><span class="token delimiter punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">}</span></span><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">"</span></span> <span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">}</span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">)</span> <span class="token keyword keyword-end" style="box-sizing: border-box; color: rgb(0, 119, 170);">end</span> <span class="token keyword keyword-end" style="box-sizing: border-box; color: rgb(0, 119, 170);">end</span
topics <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">=</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">%w[app/uninstalled orders/create orders/delete]</span></span> shop<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>with_shopify_session <span class="token keyword keyword-do" style="box-sizing: border-box; color: rgb(0, 119, 170);">do</span> topics<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span><span class="token keyword keyword-each" style="box-sizing: border-box; color: rgb(0, 119, 170);">each</span> <span class="token keyword keyword-do" style="box-sizing: border-box; color: rgb(0, 119, 170);">do</span> <span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">|</span>topic<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">|</span> ShopifyAPI<span class="token double-colon punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">::</span>Webhook<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>create<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">(</span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">{</span> topic<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">:</span> topic<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">,</span> format<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">:</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">"json"</span></span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">,</span> address<span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">:</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">"https://</span><span class="token interpolation" style="box-sizing: border-box;"><span class="token delimiter punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">#{</span><span class="token content" style="box-sizing: border-box;">your_domain</span><span class="token delimiter punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">}</span></span><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">/webhooks/</span><span class="token interpolation" style="box-sizing: border-box;"><span class="token delimiter punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">#{</span><span class="token content" style="box-sizing: border-box;">topic<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">.</span>parameterize<span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">(</span><span class="token symbol" style="box-sizing: border-box; color: rgb(153, 0, 85);">separator</span><span class="token operator" style="box-sizing: border-box; color: rgb(154, 110, 58); background: rgba(255, 255, 255, 0.5);">:</span> <span class="token string-literal" style="box-sizing: border-box;"><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">'_'</span></span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">)</span></span><span class="token delimiter punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">}</span></span><span class="token string" style="box-sizing: border-box; color: rgb(102, 153, 0);">"</span></span> <span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">}</span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153, 153, 153);">)</span> <span class="token keyword keyword-end" style="box-sizing: border-box; color: rgb(0, 119, 170);">end</span> <span class="token keyword keyword-end" style="box-sizing: border-box; color: rgb(0, 119, 170);">end</span
If you get any questions during the creation of the Shopify app then please contact us.
Reader guide
Explore this topic
Explore this topic
Use the links below to jump into next reading without leaving the article flow.
Blog categories
Recent posts
Rails CSV Export: Why Large Data Exports Fail and How to Build Them Properly
7 min
Rails Background Jobs: Why Customers Shouldn’t Wait for Work That Can Run Later
6 min
Multi-Tenant Rails: 4 Data Isolation Problems SaaS Teams Need to Prevent
5 min
What Breaks When an AI-Generated MVP Goes to Production
5 min
Similar Blogs
Explore Similar Blogs
Explore Similar Blogs
Learn how AI is transforming meetings, notes,
and team productivity.
Learn how AI is transforming meetings, notes,
and team productivity.

next step
Tell us what you are trying to build.
No spec required. Send a paragraph, an old repo link, or a screenshot of the system you are replacing. A senior Rails engineer will review it and reply with real feedback.




next step
Tell us what you are trying to build.
No spec required. Send a paragraph, an old repo link, or a screenshot of the system you are replacing. A senior Rails engineer will review it and reply with real feedback.




next step
Tell us what you are trying to build.
No spec required. Send a paragraph, an old repo link, or a screenshot of the system you are replacing. A senior Rails engineer will review it and reply with real feedback.






