When orders are synced from Shopify to Shipstation,
order notes and order attributes are merged into a single field.
This unmerges them.
Uses Shipstation webhook to process orders as they are imported.
Parses order note and saves to "Note from Buyer".
Copies orignal note to "Custom Field 1".
Before:
Note From Buyer: Special Note 4 U<br\> internal-track-data: 123abcAfter:
Note From Buyer: Special Note 4 U
Custom Field 1: Special Note 4 U<br\> internal-track-data: 123abc- Google Cloud Functions
- Google Secret Manager
- ShipStation Webhooks
- ShipStation API
gcloudcli: https://cloud.google.com/sdk/gcloud
- Clone repo
- Generate ShipStation API key
- Create new Google Secret to store ShipStation API key (secret format:
key:secret)
gcloud secrets create shipstation-key \
--replication-policy="automatic"
echo -n "KEY:SECRET" | \
gcloud secrets versions add secret-id --data-file=-- Rename
config.template.ini->config.ini - Update
config.iniwith project_id, secret_name, version - Update
config.iniwith ShipStation base URL - Deploy cloud function (replace PROJECT, REGION)
gcloud functions deploy shipstation-note-parser \
--gen2 \
--project PROJECT \
--region REGION \
--runtime php82 \
--trigger-http \
--entry-point run - Get Cloud Function URL (either cloudfunctions.net or run.app)
- Create ShipStation webhook (On New Orders) with Cloud Function URL.
composer testRun Functions Framework
https://cloud.google.com/functions/docs/running/function-frameworks
composer startCall function
(Use a service like https://webhook.site to capture webhook POST data to test with)
curl -X POST \
-H "Content-Type: application/json" \
-d '{"resource_url":"URL","resource_type":"ORDER_NOTIFY"}' \
http://localhost:8080