Skip to content

Commit 24f8d57

Browse files
committed
Merge branch 'feat/shiptheory' of github.com:Foxy/foxy-node-netlify-functions into polish/datastores
2 parents 8f79a10 + 409306a commit 24f8d57

File tree

1 file changed

+58
-5
lines changed

1 file changed

+58
-5
lines changed

src/functions/shiptheory/README.md

Lines changed: 58 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,74 @@
22

33
This integration allows you to create shipments in ShipTheory for Foxy.io transactions.
44

5+
It will create a new unlabelled shipment in ShipTheory for each Foxy Transaction.
6+
At this point, this webhook asumes there is one shipment per transaction,
7+
containing all items purchased.
8+
9+
510
## How to use it
611

12+
#### Overview
713
- Deploy this repository to your Netlify account.
814
- Set the environment variables
9-
- Grab the function URL
10-
- Configure your Foxy Store to use that URL
15+
- Configure your Foxy Store JSON Webhook
1116

1217
You will also need to configure your SipTheory rules.
1318

19+
### Deploy
20+
21+
You can use the "Deploy to Netlify" button at https://github.com/Foxy/foxy-node-netlify-functions or clone this repository.
22+
23+
If you cloned the repository, go to Netlify and click "New site from Git" and choose your repository.
24+
25+
### Set the environment variables
26+
27+
When the deploy is finished:
28+
- click the "Site settings" button;
29+
- on the sidebar, click "Build & Deploy"
30+
- Under "Environment", click "Edit variables"
31+
- Create a `FOXY_SHIPTHEORY_EMAIL` environment variable and set it to your ShipTheory email
32+
- Create a `FOXY_SHIPTHEORY_PASSWORD` environment variable and set it to you ShipTheory password
33+
- Create a `FOXY_WEBHOOK_ENCRYPTION_KEY` environment variable. Let's get it's value from Foxy.
34+
- Go to your Foxy account, choose your store and click the "integrations" link.
35+
- Check the 'JSON WEBHOOK' checkbox and **copy the value from "Encryption Key"**
36+
- If you already have a `JSON WEBHOOK` in place, click the `Add one more URL` button.
37+
- This webhook is only using the 'Transaction Created' event. **You may uncheck the others**.
38+
- Leave this page open, because we will come back to it.
39+
- Go back to your Netlify settings and paste the Encryption key in the `FOXY_WEBHOOK_ENCRYPTION_KEY` environment variable.
40+
- **Save the environment variables in Netlify**
41+
42+
### Configure your Foxy Store Webhook
43+
44+
If you haven't closed your Foxy JSON Webhook integration page, keep it open as it will be needed now.
45+
46+
First, in your app in Netlify (the page you are already if you've just done the previous step), do the following:
47+
- Click on the "Functions" tab of you Netlify app, and then on the "shiptheory" function.
48+
- Copy the "Enpoint" value from there.
49+
- Now go over to your Foxy JSON Webhook integration page and paste it into the **URL** field in the Foxy JSON Webhook.
50+
- **Click `Update Webhooks`**.
51+
52+
From this point on, new Shipments will be created in ShipTheory for each new Foxy transaction.
53+
54+
## Configure your ShipTheory rules
55+
56+
Please notice that you need to connect to a carrier in ShipTheory to be able to handle shipments.
57+
58+
For testings purposes (or if this is enough for your use case) you can create an **"Address Only Labels"** carrier account.
59+
60+
Within ShipTheory, the new shipments created can be found under the "All" tab.
61+
You can create rules to automate what should happen to each shipment.
62+
1463
# Reference
1564

1665
### Environment variables
1766

67+
This section lists all environment variables you can set to configure your webhook.
68+
69+
If new features are added to the webhook you may find new configurations here.
70+
1871
| Evironment variabel | Description |
1972
| ----------------------------- | ------------------------------------------------------- |
20-
| FOXY_WEBHOOK_ENCRYPTION_KEY | The encryption key used to validate Foxy Signature. You can get it in your Store Admin integration section|
21-
| FOXY_SHIPTHEORY_EMAIL | The email used to log in to ShipTheory.|
22-
| FOXY_SHIPTHEORY_PASSWORD | The password used to log in to ShipTheory.|
73+
| `FOXY_WEBHOOK_ENCRYPTION_KEY` | The encryption key used to validate Foxy Signature. You can get it in your Store Admin integration section|
74+
| `FOXY_SHIPTHEORY_EMAIL` | The email used to log in to ShipTheory.|
75+
| `FOXY_SHIPTHEORY_PASSWORD` | The password used to log in to ShipTheory.|

0 commit comments

Comments
 (0)