Backend API
Fields
id
objectIdThe unique identifier for the event.
date_created
dateautoDate and time the event was created.
date_updated
dateautoDate and time the event was updated.
model
stringrequiredThe name of the model for which the events are associated.
type
stringrequiredThe trigger type for the event.
data
objectThe data or payload of the event.
data.id
objectIdThe unique identifier for the event data object.
notes
stringNotes stored on the event's webhook.
user_id
objectIdID of the user that configured the webhook which triggers the event.
webhooks_pending
intThe number of webhooks still pending to fire.
webhooks
array of WebhooksAn array of pending webhooks
The event model
{
"model": "accounts",
"type": "account.created",
"data": {
"email": "martinseptim@waynonpriory.net",
"first_name": "Martin",
"last_name": "Septim",
"password": "theblades123",
"email_optin": true,
"currency": "USD",
"name": "Martin Septim",
"date_created": "2022-06-27T03:39:45.152Z",
"type": "individual",
"order_count": 0,
"order_value": 0,
"balance": 0,
"id": "62b9268145139e0019e246ca"
},
"date_created": "2022-06-27T03:39:45.461Z",
"date_updated": "2022-06-27T03:39:45.875Z",
"webhooks_pending": 0,
"id": "62b9268145139e0019e246cb"
}
Retrieve an existing event using the id that was returned during creation.
Arguments
id
objectIdThe unique identifier for the event.
const swell = require('swell-node').init('store-id', 'secret-key');
await swell.get('/events/{id}', {
});
The event model
{
"user_id": "606f0fdd255b020caaa3f577",
"model": "shipments",
"type": "shipment.created",
"data": {
"order_id": "62bc642d912a9800199ea465",
"items": [
{
"product_id": "628ba3c7499bba0019b1a961",
"order_item_id": "62bc63892fafef0019eb2312",
"quantity": 1,
"id": "62bc64bc2fafef0019eb231f"
},
{
"product_id": "628ba442499bba0019b1a96d",
"order_item_id": "62bc639293cb7c0019423b5f",
"quantity": 1,
"id": "62bc64bc2fafef0019eb2320"
},
{
"product_id": "628ba6011869c10019b41f70",
"order_item_id": "62bc639e629aa900197ff786",
"quantity": 1,
"id": "62bc64bc2fafef0019eb2321"
},
{
"product_id": "628ba67a1869c10019b41f76",
"order_item_id": "62bc63a293cb7c0019423b63",
"quantity": 1,
"id": "62bc64bc2fafef0019eb2322"
},
{
"product_id": "628ba6b7499bba0019b1a9b2",
"order_item_id": "62bc63a793cb7c0019423b66",
"quantity": 1,
"id": "62bc64bc2fafef0019eb2323"
},
{
"product_id": "628ba701499bba0019b1a9bb",
"order_item_id": "62bc63aa93cb7c0019423b69",
"quantity": 1,
"id": "62bc64bc2fafef0019eb2324"
}
],
"service": "international",
"tracking_code": null,
"carrier": null,
"notes": "Let's hope the packages get past the Gatekeeper...",
"service_name": "International",
"destination": {
"name": "Sheogorath",
"address1": "New Sheoth Palace",
"address2": null,
"city": "Shivering Isles",
"state": "TX",
"zip": "78757",
"country": "US",
"phone": null
},
"date_created": "2022-06-29T14:42:04.017Z",
"number": "S100004",
"id": "62bc64bc2fafef0019eb231e"
},
"date_created": "2022-06-29T14:42:04.272Z",
"id": "62bc64bc2fafef0019eb2325"
}
Return a list of events.
Arguments
expand
stringExpand link fields and child collections by using the expand argument.
- For example, expand=account would return a related customer account if one exists.
When the field represents a collection, you can specify the query limit.
- For example, expand=variants:10 would return up to 10 records of the variants collection.
See expanding for more details.
fields
stringReturns only the specified fields in the result.
- For example fields=name,slug would return only the fields name and slug in the response.
Supports nested object and array fields using dot-notation.
- For example, items.product_id. The product id is always returned.
include
objectInclude one or more arbitrary queries in the response which are potentially related to the main query.
See including for more details.
limit
intLimit the number of records returned, ranging between 1 and 1000. Defaults to 15.
page
intThe page number of results to return given the specified or default limit.
search
stringA text search is performed using the search argument. Searchable fields are defined by the model.
- For example, search=red would return records containing the word "red" anywhere in the defined text fields.
See searching for more details.
sort
stringExpression to sort results by using a format similar to a SQL sort statement.
- For example, sort=name asc would return records sorted by name ascending.
See sorting for more details.
where
objectAn object with criteria to filter the result.
- For example, active=true would return records containing a field active with the value true.
It's also possible to use query operators, for example, $eq, $ne, $gt, and more.
See querying for more details.
const swell = require('swell-node').init('store-id', 'secret-key');
await swell.get('/events', {
});
Response
{
"count": 1105,
"results": [
{
"user_id": "606f0fdd255b020caaa3f577",
"model": "accounts",
"type": "account.updated",
"data": {
"id": "62b1e36767145000197b2bd6",
"shipping": {
"first_name": "Runs-in-circles",
"last_name": null,
"company": "",
"address1": "Shivering isles",
"address2": null,
"city": null,
"zip": "34534",
"country": "US",
"state": "AL",
"phone": null,
"name": "Runs-in-circles",
"account_address_id": "62bcb8ec629aa900197ffb8d"
}
},
"date_created": "2022-06-29T20:41:17.225Z",
"id": "62bcb8ed629aa900197ffb8f"
},
{
"user_id": "606f0fdd255b020caaa3f577",
"model": "accounts:addresses",
"type": "account.address.created",
"data": {
"parent_id": "62b1e36767145000197b2bd6",
"name": "Runs-in-circles",
"first_name": "Runs-in-circles",
"last_name": null,
"address1": "Shivering isles",
"address2": null,
"city": null,
"state": "AL",
"zip": "34534",
"country": "US",
"phone": null,
"company": null,
"fingerprint": "0f1d3af32dd2dc0607c12ace5b2ea9c5",
"date_created": "2022-06-29T20:41:16.931Z",
"active": true,
"id": "62bcb8ec629aa900197ffb8d"
},
"date_created": "2022-06-29T20:41:17.192Z",
"id": "62bcb8ed629aa900197ffb8e"
},
{
"model": "settings",
"type": "setting.updated",
"data": {
"id": "store",
"settings": {
"date_updated": "2022-06-29T19:45:22.163Z"
}
},
"date_created": "2022-06-29T19:45:22.598Z",
"id": "62bcabd2bc89e4001a4c4ecf"
},
{
"user_id": "606f0fdd255b020caaa3f577",
"model": "settings",
"type": "setting.updated",
"data": {
"id": "store",
"settings": {
"date_updated": "2022-06-29T19:40:52.478Z"
}
},
"date_created": "2022-06-29T19:40:53.402Z",
"id": "62bcaac5629aa900197ffb35"
},
{. . .},
}
These are the event types that are currently recorded in Swell, grouped by model. They use a common past tense naming convention and all models (including custom ones) have the basic events .created, .updated, and .deleted. Some models also trigger events specific to their functionality.
You can see an example of a model payload by selecting an event type.
- account.deleted
Occurs when an account is deleted.
- account.address.deleted
Occurs when an address is deleted from an account.
- account.created
Occurs when an account is created.
- account.credit.created
Occurs when store credit is added to an account.
- account.updated
Occurs when an account’s information changes.
- account.account-card.deleted
Occurs when a credit card is deleted from an account.
- account.credit.deleted
Occurs when an account’s store credit is deleted.
- account.credit.updated
Occurs when the details of an account’s store credit changes.
- account.account-card.updated
Occurs when an account’s credit card information changes.
- account.account-card.created
Occurs when a credit card is added to an account.
- account.address.updated
Occurs when an account’s address changes.
- account.address.created
Occurs when an address is added to an account.
- cart.created
Occurs when a product is added to a cart.
- cart.converted
Occurs when a cart is converted to an order.
- cart.deleted
Occurs when a cart is deleted.
- cart.abandoned
Occurs when products in a cart are left and not paid for.
- category.updated
Occurs when the properties of a category change.
- category.created
Occurs when a category is created.
- category.products.added
Occurs when a product is added to a category.
- category.products.removed
Occurs when a product is removed from a category.
- category.deleted
Occurs when a category is deleted.
- coupon.deleted
Occurs when a coupon is deleted.
- coupon.code.deleted
Occurs when a coupon code is deleted.
- coupon.updated
Occurs when the details of a coupon change.
- coupon.generation.completed
Occurs when a series of coupon codes are generated.
- coupon.code.created
Occurs when a coupon code is created.
- coupon.created
Occurs when a coupon is created.
- invoice.deleted
Occurs when an invoice is deleted.
- invoice.refund_failed
Occurs when an attempt to refund an invoice fails.
- invoice.refund_succeeded
Occurs when an attempt to refund an invoice succeeds.
- invoice.updated
Occurs when invoice details change.
- invoice.created
Occurs when an invoice is created.
- order.delivered
Occurs when a shipment is marked delivered
- order.deleted
Occurs when an order is deleted.
- order.canceled
Occurs when an order is canceld
- order.updated
Occurs when order details change.
- order.created
Occurs when an order is created.
- order.paid
Occurs when an order is paid.
- order.submitted
Occurs when an order is submitted.
- page.created
Occurs when a page is created.
- page.updated
Occurs when information on a page changes.
- page.deleted
Occurs when a page is deleted.
- payment.voided
Occurs when a payment is voided.
- payment.succeeded
Occurs when a payment attempt succeeds.
- payment.refund.succeeded
Occurs when an attempt to refund payment succeeds.
- payment.refund.failed
Occurs when an attempt to refund payment fails.
- payment.failed
Occurs when a payment attempt fails.
- payment.refund.voided
Occurs when an attempt to refund payment is voided.
- products.variant.updated
Occurs when the properties of a product variant change.
- products.updated
Occurs when the properties of a product change.
- products.created
Occurs when a product is created.
- products.variant.deleted
Occurs when a product variant is deleted.
- products.stock_adjusted
Occurs when product stock details change.
- products.deleted
Occurs when a product is deleted.
- products.variant.created
Occurs when a product variant is created.
- promotion.deleted
Occurs when a promotion is deleted.
- promotion.created
Occurs when a promotion is created.
- promotion.updated
Occurs when a promotion is updated.
- settings.updated
Occurs when the properties of your store setting change.
- shipment.canceled
Occurs when a shipment is canceled.
- shipment.updated
Occurs when the shipment details change.
- shipment.deleted
Occurs when a shipment is deleted
- shipment.created
Occurs when a shipment is created.
- subscription.trial_ended
Occurs when a subscription's trial period ends
- subscription.canceled
Occurs when a subscription is cancelled
- subscription.trial_will_end
Occurs when a subscriptions trial is near ending
- subscription.resumed
Occurs when a subscription plan is resumed.
- subscription.invoiced
Occurs when a subscription plan is invoiced.
- subscription.created
Occurs when a subscription plan is created.
- subscription.paused
Occurs when a subsription is paused
- subscription.paid
Occurs when a subscription plan is paid.
- subscription.activated
Occurs when a subscription is activated
- subscription.updated
Occurs when an account’s subscription plan changes.
- subscription.deleted
Occurs when a subscription is deleted