FaxStore

Prerequisites
Installation & Setup
API
Config File
Developer Mode
Enable Debug Mode
Events
Extensions
Features
Integrations
License System Extension
Permissions
Updating FaxStore

Weblutions Documentation > FaxStore > Events

Events

Events are a great way to build and develop extensions in FaxStore. Events are always being added and are documented here for your use in extensions or development of FaxStore.

Suggest an event at the below link if you'd like to see a particular event

Suggest new event

Using events is easy as pie, all you do is use the associated name and arguments. Here are some examples.

Listen for an event (on)

faxstore.on('login', function(userObject, DbUserResults) {
  // Do as you wish in the event, you can fetch data and even do other actions like make an automated webhook post.
  console.log(userObject);
  // userObject is the data passed in the users session (in an object), this will contain some login service data like their ID, avatar, and possibly guilds.
  console.log(DbUserResults);
  // This is an SQL object which contains the users database information.
});

Emit events (emit)

const date = Date.now();
faxstore.emit('CreateAuditLog', 'UserID', 'Logged in', `logged in at <t:${date}>`);

So these two examples could be used together to create an audit log for when users login. Here's an example

faxstore.on('login', function(userObject, DbUserResults) {
  const date = Date.now();
  faxstore.emit('CreateAuditLog', DbUserResults.userId, 'Logged in', `logged in at <t:${date}>`);
  
  // This example uses 'DbUserResults.userId' over 'userObject.id' as it can be more reliable and correlates to the database.
  // However, both would work the same.
});

Events Dictionary

  • on is a listen event that triggers with faxstore.on()
  • emit is to emit an event to the system with faxstore.emit()


NameArgumentsDescriptionType
CreateAuditLogUserId, Action, DetailsCreate An Audit Log. All Arguments Required.emit
pushNotificationuserId, details, redirectCreates a notification on the site for this user. All arguments required and are strings.emit
removeDiscordRoleuserId, rolesRemoves roles from the user is possible.emit
addDiscordRoleuserId, rolesAdds roles to the user if possible.emit
invoiceCreatedinvoiceId, invoicedUser, staffUser, invoicedItems, dueEmits when a invoice is created.on
invoiceUpdatedinvoiceId, invoicedUser, due, stateWhen an invoice is automatically updated for it's status, this event emits.on
invoicePaidinvoiceID, paymentType, receiptID, invoicedItemsEmits when an invoice is paid by a user.on
invoiceEditedinvoiceObject, staffUserEmits when a invoice is edited by a staff member.on
loginuserObject, DbUserResultsEmits when a user logs into the site.on
logoutuserObjectEmits when a user logs out of the site.on
createUserAccountuserObject, serviceTypeEmits when a users account is first created.on
onStartlicenseKey, siteDomainEmits when FaxStore first starts.on
userAccountDeletestaffUserId, userIdEmits when a users account is deleted.on
userAccountUnbanstaffUserId, userEmits when a users account is un-banned.on
userAccountBanstaffUserId, userEmits when a users account is banned.on
userAccountUndisabledstaffUserId, userEmits when a users account is un-disabled.on
userAccountDisabledstaffUserId, userEmits when a users account is disabled.on
userAccountStaffNoteEditedstaffUserId, userEmits when a staff member updates a users staff notes.on
userItemAddeddataEmits when an item is added to an account.on
userCustomItemAddeddataEmits when a custom file is added to an account.on
userItemRemoveddataEmits when an item is removed to an account.on
userItemDownloadeddataEmits when a user downloads a file on their accounton
createCheckoutuserObject, cart, total, promoCode, paymentTypeEmits when a checkout is made on the site.on
checkoutReturnuserObject, paymentId, cartEmits when a checkout is returned to the store.on
checkoutCanceluserIdEmits when a checkout is cancelled by the useron
subscriptionInvoiceCreatedinvoiceId, userObject, items, expiryEmits when a subscriptions invoice is first generatedon
subscriptionCancelledsubscription, userObjectEmits when a subscription is cancelled by a user.on
subscriptionEditedupdatedSubscription, userObjectEmits when a subscription is edited by a user.on
subscriptionEndedsubscription, userIdEmits when a subscription ends after being cancelled.on
releaseCreatestoreItem, release, releaseId, staffUserEmits when a release is createdon
releaseEditrelease, staffUserEmits when a release is editedon
releaseDeleterelease, staffUserEmits when a release is deletedon
blogpostCreateuserId, blogpostEmits when a new blog post is createdon
blogpostDeleteuserId, blogpostIdEmits when a blog post gets deletedon
hasPermissionuserData, permissionUserData (object) and permission (string or array). This event is to check for a permission a user may have.on
formCreateuserObject, formObjectEmits when a form is createdon
formSubmitteduserObject, formId, formObject, submissionObjectEmits when a form gets submitted by a useron
formReplyuserObject, formId, commentEmits when a form is replied toon
formDeleteuserObject, formObjectEmits when a form is deletedon
reviewCreateduserObject, reviewId, reviewObjectEmits when a revire is created by a useron
reviewResponseuserObject, reviewId, commentEmits when a review is replied to by a staff memberon
reviewDeleteduserObject, reviewIdEmits when a review is deletedon
storeListingCreateuserObject, listingObjectEmits when a new store listing is created.on
storeListingEdituserObject, listingId, listingObjectEmits when a store listing is edited.on
storeListingPauseuserObject, listingId, newStateEmits when a store listing pause setting is toggled.on
storeListingDeleteuserObject, listingId, listingObjectEmits when a store listing is deletedon
notificationCreateduserId, redirectURL, detailsObjectEmits when a notification is created.on
quoteCreateduserObject, quoteID, quoteObject, createdAtEmits when a quote is created.on
quoteEditeduserObject, quoteID, quoteObjectEmits when a quote is edited/updatedon
quoteAccepteduserId, quoteIDEmits when a quote accepted by a useron
packageCreateduserObject, packageID, packageObject, createdAtEmits when a package is created.on
packageEditeduserObject, packageID, packageObjectEmits when a package is editedon
packageDeleteduserObject, packageID, packageObjectEmits when a package has been deletedon
initialiseDiscordBotsettingsEmits when the store initialises the Discord bot.on

Improve this page


Suggest an edit

Review this page

FAXES

2 recommend this page