Wix.Activities

getActivityById

Gets a specific Activity that occurred on the current site.

SDK Version: SDK 1.28.0+
Components: Dashboard

Syntax:

Copy
1
getActivityById(id, onSuccess, onFailure)

Parameters:

NameTypeDescription
id (required)StringThe ID of the activity to look up
onSuccess (required)FunctionCallback function to receive an object with data about the activity
onFailure (required)FunctionCallback triggered if the data could not be returned successfully

Example:

Copy
1
Wix.Activities.getActivityById(id, onSuccess, onFailure)

postActivity

This method posts an activity to the current site. When the Activity is successfully created, the id of the activity will be returned. If schema validation fails, or other errors occur, an error is returned.

SDK Version: SDK 1.25.0 – 1.77.0+
Display: Live Site
Components: Widget, Pinned (aka Fixed-Position) Widget, Page, Modal, Popup

Syntax:

Copy
1
postActivity(activity, onSuccess, \[onFailure\])

Parameters:

NameTypeDescription
**activity (required)ObjectAn activity descriptor (must follow specific type/schema pattern)
activity.type (required)Wix.Activities.TypeThe activity type as detailed in the table below
activity.info (required)ObjectDetailed information about this activity, according to the activity type schema
activity.details (required)ObjectMore information about the activity
activity.details.additionalInfoUrl (required)StringThe URL to open when the user clicks on the activity notification in the site’s dashboard. Apps with a dashboard component: link to this specific activity within your app’s Dashboard component:HTTP://www.wix.com/my-account/app/<appID>/<appInstanceID>/<appState>. For example, if a site visitor makes a purchase, direct users to a page where they can see details about this purchase. Apps without a dashboard component: Enter “null” or direct the user to a page with information about this activity. For example, if a site visitor liked a photo, direct the user to this photo on the live site.
activity.contactUpdate (required)ObjectInformation about the site visitor who performed this activity. If you have any information about the site visitor, use contactUpdate to link the activity to a site Contact. Make sure to include at least the email or phone number in your request - we need it to create/update the contact. If not, use 'null'. However, note that we won't display the activity in the site's dashboard until we can link the activity to a contact.
activity.contactUpdate.nameObjectContact's name
activity.contactUpdate.name.prefixStringName prefix (limited to 100 characters)
activity.contactUpdate.name.firstStringFirst name (limited to 100 characters)
activity.contactUpdate.name.middleStringMiddle name (limited to 100 characters)
activity.contactUpdate.name.lastStringLast name (limited to 100 characters)
activity.contactUpdate.name.suffixStringName suffix (limited to 100 characters
activity.contactUpdate.pictureStringURL to the contact's photo
activity.contactUpdate.companyObjectContact's company details
activity.contactUpdate.company.roleStringContact's role at the company (limited to 100 characters)
activity.contactUpdate.company.nameStringContact's company name (limited to 100 characters)
activity.contactUpdate.emailsArray[object]Contact's emails
activity.contactUpdate.emails.idNumberID of this email within the array
activity.contactUpdate.emails.tag (required)StringTag for this email - home, work, etc. (limited to 100 characters)
activity.contactUpdate.emails.email (required)StringContact's email address (limited to 250 characters)
activity.contactUpdate.emails.emailStatus"optOut", "transactional", or "recurring"The subscription status for this email. optOut: Contact unsubscribed from all emails. transactional: Contact subscribed to non-promotional emails. recurring: Contact subscribed to all emails.
activity.contactUpdate.emails.deliveryStatus‘valid’, ‘spam’, ‘complaint’, ‘rejected’, ‘deferral’, ‘bounce’Email delivery status. valid: When emails are delivered successfully. spam: When emails are marked as spam by the recipient. complaint: When the recipient of the email has made a complaint to the email provider. rejected: When the email is rejected by email provider. deferral: When your email provider refuses to send emails. bounce: When the mailbox is full, email address doesn't exist, etc.
activity.contactUpdate.phonesArray[object]Contact's phone
activity.contactUpdate.phones.IdNumberID of this phone number within the array
activity.contactUpdate.phones.tag (required)StringTag for this phone number - home, work, etc (limited to 100 characters)
activity.contactUpdate.phones.phone (required)StringContact's phone number (limited to 30 characters)
activity.contactUpdate.phones.normalizedPhoneStringContact's normalized phone number
activity.contactUpdate.addressesArray[object]Contact's address
activity.contactUpdate.addresses.idNumberID of this address within the array
activity.contactUpdate.addresses.tag (required)StringTag for this address - home, work, etc (limited to 100 characters)
activity.contactUpdate.addresses.addressStringContact's street address (limited to 250 characters)
activity.contactUpdate.addresses.neighborhoodStringContact's neighborhood (limited to 100 characters)
activity.contactUpdate.addresses.cityStringContact's city (limited to 100 characters)
activity.contactUpdate.addresses.regionStringContact's region, such as a U.S. state or Canadian province (limited to 100 characters)
activity.contactUpdate.addresses.countryStringContact's country (limited to 100 characters)
activity.contactUpdate.addresses.postalCodeStringContact's postal code (limited to 20 characters)
activity.contactUpdate.urlsArray[object]URLs associated with the contact, like Facebook or LinkedIn
activity.contactUpdate.urls.idNumberID of this URL within the array
activity.contactUpdate.urls.tag (required)StringTag for this URL - personal, work, etc (limited to 100 characters)
activity.contactUpdate.urls.url (required)StringThe URL
activity.contactUpdate.datesArray[object]Important dates for this contact, like birthday
activity.contactUpdate.dates.idNumberID of this date within the array
activity.contactUpdate.dates.tag (required)StringTag for this date - birthday, anniversary, etc (limited to 100 characters)
activity.contactUpdate.dates.date (required)StringThe date, as an ISO 8601 timestamp
onSuccess (required)FunctionSuccess callback function
onFailureFunctionFailure callback function

The activity types that you can currently post:

TypeActivityDescription
FORM_CONTACT_FORMform/contact-formWhen your app submits a contact form
FORM_SUBSCRIPTION_FORMform/subscription-formWhen your app submits a subscription form
FORM_FORMform/formWhen your app submits another type of form
SCHEDULER_APPOINTMENTscheduler/appointmentWhen an appointment is made
SCHEDULER_CONFIRMATIONscheduler/confirmationWhen an appointment is confirmed. Availability: Since 1.45.0
SCHEDULER_CANCELscheduler/cancelWhen an appointment is cancelled. Availability: Since 1.45.0
SOCIAL_COMMENTsocial/commentWhen a site visitor posts a comment on the site. Availability: Since 1.61.0
SOCIAL_SHARE_URLsocial/share-urlWhen a site visitor shares an item (like a blog post or photo) on social media. Availability: Since 1.61.0
SOCIAL_TRACKsocial/trackWhen a site visitor takes one of these social media actions on the user’s channel: like, follow, subscribe, pin. Availability: Since 1.61.0
HOTELS_PURCHASEhotels/purchaseWhen a hotel service is purchased
HOTELS_PURCHASE_FAILEDhotels/purchase-failedWhen a purchase (of the hotel service) could not be completed
HOTELS_RESERVATIONhotels/reservationWhen a reservation is made
HOTELS_CONFIRMATIONhotels/confirmationWhen a reservation is confirmed
HOTELS_CANCELhotel/cancelWhen a reservation is cancelled
TRACK_PLAYmusic/track-playWhen a request to start playing a song is made
TRACK_SKIPmusic/track-skipWhen a track was skipped
TRACK_PLAYEDmusic/track-playedWhen a song finished playing
TRACK_LYRICSmusic/track-lyricsWhen the track lyrics are requested
TRACK_SHAREmusic/track-shareWhen a track is shared using your app
ALBUM_SHAREmusic/album-shareWhen an album is shared using your app
ALBUM_FANmusic/album-fanWhen a visitor becomes a fan of an album
ALBUM_PLAYEDmusic/album-playedWhen an album finished playing
ECOMMERCE_CART_ADDecommerce/cart-addWhen an item is added to a cart. Availability: Since 1.45.0
ECOMMERCE_CART_REMOVEecommerce/cart-removeWhen an item is removed from a cart. Availability: Since 1.45.0
ECOMMERCE_CART_CHECKOUTecommerce/cart-checkoutWhen a checkout process has begun with this cart. Availability: Since 1.45.0
ECOMMERCE_CART_ABANDONecommerce/cart-abandonWhen a cart is abandoned. Availability: Since 1.45.0
ECOMMERCE_PURCHASEecommerce/purchaseWhen the checkout process has completed
MESSAGE_IMmessaging/imWhen a chat/sms message is sent between a Wix user and a site visitor/contact
EVENTS_RSVPevents/rsvpWhen a guest RSVPs to an event. Availability: Since 1.77.0
RESTAURANTS_ORDERrestaurants/orderWhen an order is placed in a restaurant. Availability: Since 1.77.0.

Example:

Copy
1
var activity = {
2
type: Wix.Activities.Type.FORM_CONTACT_FORM,
3
info: {
4
subject: "My Subject",
5
content: { message: "My Message"}
6
},
7
details: {
8
additionalInfoUrl:'http://www.wix.com/my-account/app/{app-def-id}/{instance-id}/{app-related-deep-link}',
9
summary: ""
10
},
11
contactUpdate:{
12
name: {first:"Kanye"},
13
emails: [ {tag: "main", email: "email@email.com"} ]
14
}
15
};
16
17
var onSuccess = function(d){console.log("Activity ID: " + d.activityId + ", Contact ID: " + d.contactId)};
18
var onFailure = function(d){console.log("Failure message:" + d)};
19
20
Wix.Activities.postActivity(activity, onSuccess, onFailure);
Was this helpful?
Yes
No