Skip to content

Berardpi/connector-shopify

 
 

Repository files navigation

Develop Codeship Status for maestrano/connector-shopify Master Codeship Status for maestrano/connector-shopify

Shopify Connector

The aim of this connector is to implement data sharing between Connec! and Shopify

Configuration

Configure your Shopify application. To create a new Shopify application: https://docs.shopify.com/api/guides/introduction/getting-started

Create a configuration file config/application.yml with the following settings (complete with your Shopify / Connec! credentials)

connec_api_id:
connec_api_key:
shopify_api_id:
shopify_api_key:

Run the connector

First time setup


# Install JRuby and gems the first time, install redis-server
rvm install jruby-9.0.5.0
gem install bundler
bundle
gem install foreman
sudo apt-get install redis-server

Start the application

export PORT=5678
export RACK_ENV=development
foreman start

Run the connector locally against the Maestrano production environment

Add in the application.yml file the following properties:

api_host: 'http://localhost:3000'
connec_host: 'http://localhost:8080'

Test webhooks

Install ngrok Start in on your application port (for example 5678)

ngrok http 5678

this will open a console with an url that is tunnelling to your localhost (for example https://aee0c964.ngrok.io) update the app_host in the application.yml

app_host: 'https://aee0c964.ngrok.

then edit your app settings in Shopify https://app.shopify.com/services/partners/api_clients/[YOURAPPID]/edit add the redirection URL:

edit-shopify-app-url.png

Destroy All Webhooks

this command will destroy all the webhooks of the shopify shop linked to the application.

org_uid = 'cld-9p9y'
o = Maestrano::Connector::Rails::Organization.find_by_uid(org_uid)
Shopify::Webhooks::WebhooksManager.new(org_uid, o.oauth_uid, o.oauth_token).destroy_all_webhooks
shop = 'uat-test-store.myshopify.com'
o = Maestrano::Connector::Rails::Organization.find_by_oauth_uid(shop)
Shopify::Webhooks::WebhooksManager.new(o.uid, o.oauth_uid, o.oauth_token).destroy_all_webhooks

Update application metadata

How to update the application metadata in MnoHub console

url =  'https://aa386fdb.ngrok.io'
metadata_url =  url + '/maestrano/metadata'
app = App.where("name LIKE :prefix", prefix: "%shopify%").first
if app
  app.fetch_metadata!(metadata_url)
else
  p 'could not find shopify App'	
end

About

Connector for Shopify

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 83.5%
  • HTML 10.2%
  • CSS 4.4%
  • JavaScript 1.9%