Activities
Apps in Wix work together by sharing information about site visitor activity. An activity is a visitor’s interaction with the site, such as filling out a contact form, making a purchase, or sharing a page from the site on social media.
You’ll use the WixHive to request information that’s useful for your app, and also post information that your app collects.
Activities are tracked by a visitor’s email, phone, or cookie. If a site visitor is a contact, you will be able to link between the contact and its activities.
Read more about the different activity types and their schemas below.
How it Works
When you register your app in the dev center, you can sign up to receive or post Activities about different events that happens within the website, according to your product needs.
- Post an activity to report about events that occurred within your app.
- Get an activity when it was reported to trigger an action within your app.
Post Activity
When posting an Activity to Wix, make sure the data conforms to the specific schema for that type of Activity, so that other apps know what to expect when receiving it. Each type of Activity has its own schema, represented in JSON schema format.
Activities are connected to a session, which is a cookie stored in the site visitor’s browser. This means that when you (or another app) post Activities from the same browser session, they are all linked to the same site visitor. If the site visitor is a Contact, all Activities connected to this session are linked to the Contact, even Activities posted before the Contact was created.
How to Post an Activity
Use the Wix.Activities.postActivity SDK method.
You can see the full list of parameters in the method documentation, but here’s a quick look at the most important parameters:
- activity.Info: Build this object using the correct activity schema. Refer to the list of activities and their schemas.
- contactUpdate: Add any information your app has about the site visitor (such as email, phone, or name) in the contactUpdate object. This object links the Activity to a Contact.
- details.additionalInfoUrl: When an important activity is posted, we display a notification in the site’s dashboard. Users can click on this notification to see more information about the activity, so define this URL when you post the activity. (Check out the section below – “What happens in the site’s dashboard when you post an activity” for more details.)
What happens in your app when you post the activity
Once you post the activity, you’ll receive the Activity ID immediately. If you used the contactUpdate object, we’ll check if the contact exists for this browser session:
- If a contact already exists for this session, we’ll add the new information you provided to this contact and send you the contact ID.
- If this contact doesn’t exist yet, we’ll create a new contact and send you its ID. All activities connected to this specific session will be linked to the new contact.
What happens in the site’s dashboard when you post an activity
You can use the points below as a quick check to make sure you implemented the WixHive correctly.
If you provided the site visitor’s email/phone number when you posted the activity, we’ll link the activity to a contact and show the new information to users. Here’s what users will see in the site’s dashboard – and what you should see when testing the WixHive in your app:
- A notification for important activities: Users can click on this notification to see more information about the activity. You can direct users to a URL with more information – use the additionalInfoUrl parameter in the postActivity method.
We display notifications for these activities:- Form activities (contact-form, subscription-form, form)
- Scheduler appointment activity
- eCommerce purchase activity
- Hotels reservation activity
- Social track activity
Note: If you think it’s important for us to notify users about an activity posted by your app, let us know!
-
A new message in the Wix Engage app: Users can see important activities that happened in their site – whether it’s done by an existing contact or an anonymous site visitor. (You can see the full list of important activities, above.)
-
New information about site visitors: When users go to the contact’s page, they can see the activity you posted, as well as any new information you sent about the contact. If the site visitor is a new contact, users will see the new contact in the contacts section of the dashboard.
(You’ll add this information in the contactUpdate parameter in the postActivity method.)
Note: Activities that are not linked to a Contact will not be visible to users.
Get Activity
When you register your app, you can sign up to receive immediate notification when an Activity occurs. These events will be delivered to your app via webhooks and will include the Activity ID. To get the Activity data use the HTTP API or the JavaScript SDK with the relevant Activity ID.
There will be times when your app needs to get a list of Activities that have already occurred on a site. In such cases, you can request these Activities through our JavaScript SDK or through our HTTP API, as shown below.
You can use parameters to filter your search:
- Use the from and until parameters to retrieve Activities by creation time.
- Set the scope parameter to app to get Activities that were created by your app. Set the scope parameter to site to get Activities that were created by all apps on a site. Default is site.
- Use the activityTypes parameter to filter by the type of Activity.
NODEJS
1var ONE_HOUR = 60 * 60 * 1000;2var oneHourAgo = new Date(new Date().getTime() - ONE_HOUR);3contact.getActivities(null,4 {5 from: oneHourAgo.toISOString(),6 until: new Date().toISOString(),7 activityTypes: [api.Activities.TYPES.ALBUM_FAN.name, api.Activities.TYPES.ALBUM_SHARE.name],8 scope: 'app',9 pageSize: 5010 }).then(11 function(pagingActivitiesResult){12 var activities = pagingActivitiesResult.results;13 console.log(activities);14 },15 function(error){16 console.log(error);17 }18)
RUBY
1# Get all Activities2client.activities3
4# Filter by Activity type5client.activities(activityTypes: Hive::Activities::MUSIC_ALBUM_FAN.type)6
7# Filter by date range8client.activities(from: Time.now.iso8601(3), until: Time.now.iso8601(3))
Activity Schemas
The activities listed below can be posted by your application to report about events that occurred within your app.
Forms
Use the following activities for form events in your app:
- Contact-Form: when your app submits a contact form.
- Subscription-Form: when your app submits a subscription from.
- Form: when your app submits another type of form, like a survey.
You’ll add the site visitor’s details (name, email, etc) in the contactUpdate object, and not in the form activity itself (see more information on posting an activity). So there’s no need to post form fields that ask for these details.
Contact-Form
Name | Type | Description |
---|---|---|
subject | Array[object] | Subject the site visitor entered in the contact form |
content (required) | Object | Content the site visitor entered in the contact form |
content.message | String | Message text |
content.media | Array | Media (for example, images the site visitor uploaded to the message) |
additionalFields | Array[object] | More details submitted in the form |
additionalFields.name | String | Key name |
additionalFields.value | String | Key value |
Get the Contact-Form Activity JSON.
Example:
1var activity = {2 type:Wix.Activities.Type.FORM_CONTACT_FORM,3 info:{ subject:"My Subject", content:{message:"My Message"}},4 details:{ additionalInfoUrl:'http://www.wix.com/my-account/app/{app-def-id}/{instance-id}/{app-related-deep-link}', summary:""},5 contactUpdate:{ name:{first:"Kanye"}, emails:[{tag:"main",email:"email@email.com"}]}6};7
8var onSuccess = function(d){console.log("Activity ID: " + d.activityId + ", Contact ID: " + d.contactId)};9var onFailure = function(d){console.log("Failure message:" + d)};10Wix.Activities.postActivity(activity, onSuccess, onFailure);
Subscription-Form
Name | Type | Description |
---|---|---|
additionalFields | Array[object] | More details submitted in the form |
additionalFields.name | String | Key name |
additionalFields.value | String | Key value |
Get the Subscription-Form Activity JSON.
Example:
1var activity = {2 type:Wix.Activities.Type.FORM_SUBSCRIPTION_FORM,3 info: {additionalFields:[{name:"newsletterType", value:"Fitness"}]},4 details:{additionalInfoUrl:"http://www.wix.com/my-account/app/{app-def-id}/{instance-id}/{app-related-deep-link", summary:''},5 contactUpdate:{"name":{first:"firstName", middle:"middleName", last:"lastName"}, emails:[{tag:"main", email:"email@gmail.com"}]}6};7
8var onSuccess = function(d){console.log("Activity ID: " + d.activityId + ", Contact ID: " + d.contactId)};9var onFailure = function(d){console.log("Failure message:" + d)};10Wix.Activities.postActivity(activity, onSuccess, onFailure);
Form
Name | Type | Description |
---|---|---|
type | "CUSTOMER_SATISFACTION", "SURVEY", "EVENT_REGISTRATION", "ORDER", "DONATION", "QUIZ", "OTHER" | Type of form submitted: * CUSTOMER_SATISFACTION: Form to give feedback. * SURVEY: Form for a general survey. * EVENT_REGISTRATION: Form to register for an event. * ORDER: Form to place an order. * DONATION: Form to make a donation. * QUIZ: Form to answer general questions. * OTHER: Any other type of form that's not listed here. |
fields | Array[object] | Fields in the form |
name | String | Key name |
value | String | Key value |
Example:
1var activity = {2 type:Wix.Activities.Type.FORM_FORM,3 info:{type:"SURVEY", fields:[{name:"vegan",value:"yes"}]},4 details:{additionalInfoUrl:"http://www.wix.com/my-account/app/{app-def-id}/{instance-id}/{app-related-deep-link}", summary:""},5 contactUpdate:{name:{first:"Kanye"}, emails:[{tag:"main", email:"email@email.com"}]}6};7
8var onSuccess = function(d){console.log("Activity ID: " + d.activityId + ", Contact ID: " + d.contactId)};9var onFailure = function(d){console.log("Failure message:" + d)};10Wix.Activities.postActivity(activity, onSuccess, onFailure);
Get the Form activity JSON.
Scheduler
Use the following activities for scheduling events that occur in your app:
- Appointment: when an appointment is made.
- Cancel: when an appointment is cancelled.
- Confirmation: when an appointment is confirmed.
Appointment and Confirmation
Property | Type | Description |
---|---|---|
appointmentId (recommended) | String | The unique identifier of a scheduled appointment |
source (required) | "GUEST" or "STAFF" | Indicates who booked/confirmed the appointment |
title (required) | String | Appointment's title |
description (required) | String | Appointment's description |
infoLink | String | URL for more details about the appointment |
price | Object | Appointment’s price |
price.price (required) | Number | Price amount |
price.formattedPrice | String | Price format (i.e, €0,99 or $0.99) |
price.currency (required) | String | Currency code (i.e, EUR, USD, CAD) |
location | Object | Appointment's location |
location.address | String | Address |
location.city | String | City |
location.region | String | Region |
location.postalCode | String | Postal Code |
location.country | String | Country |
location.url | String | Location URL |
time | Object | Appointment’s scheduled time |
time.start (required) | DateTime | Scheduled start time |
time.end (required) | DateTime | Scheduled end time |
time.end (required) | String | Scheduled time zone |
attendees | Array[object] | Appointment's attendees |
attendees.contactId | String | Attendee's contact ID |
attendees.name | Object | Attendee's name |
attendees.name.prefix | String | Name prefix |
attendees.name.first | String | First name |
attendees.name.middle | String | Middle name |
attendees.name.last | String | Last name |
attendees.name.suffix | String | Name suffix |
attendees.phone | String | Attendee's phone |
attendees.email | String | Attendee's email |
attendees.notes | String | Attendee's notes (like allergies or other restrictions) |
attendees.self | Boolean | True if the Wix user who scheduled the appointment will attend |
Get the Appointment Activity and the Confirmation Activity JSONs.
APPOINTMENT
1var activity = {2 type:Wix.Activities.Type.SCHEDULER_APPOINTMENT,3 info: { appointmentId: '455',4 source:'GUEST',5 title: 'AppointmentTitle',6 description: 'AppointmentDescription',7 infoLink: 'LinkToAppointment',8 price: {price: 100, formattedPrice:'Price', currency:'USD'},9 location: {address: 'address', city: 'NY', country: 'USA'},10 time: {start:'2013-07-01T08:07:40.802Z', end:'2013-07-01T08:07:40.802Z', timezone:'US Eastern Standard Time'},11 attendees: [{contactId:'ID', name: {first:'firstName', middle:'middleName', last:'lastName'}, phone: 'phoneNumber', email: 'email@gmail.com'}]},12 details:{additionalInfoUrl:null, summary:''},13 contactUpdate:{"name":{first:"firstName", middle:"middleName", last:"lastName"}, emails:[{tag:"main", email:"email@gmail.com"}]}14};15
16Wix.Activities.postActivity(activity, onSuccess, onFailure);
CONFIRMATION
1var activity = {2 type:Wix.Activities.Type.SCHEDULER_CONFIRMATION,3 info: { appointmentId: '455',4 source:'GUEST',5 title: 'AppointmentTitle',6 description: 'AppointmentDescription',7 infoLink: 'LinkToAppointment',8 price: {price: 100, formattedPrice:'Price', currency:'USD'},9 location: {address: 'address', city: 'NY', country: 'USA'},10 time: {start:'2013-07-01T08:07:40.802Z', end:'2013-07-01T08:07:40.802Z', timezone:'US Eastern Standard Time'},11 attendees: [{contactId:'ID', name: {first:'firstName', middle:'middleName', last:'lastName'}, phone: 'phoneNumber', email: 'email@gmail.com'}]},12 details:{additionalInfoUrl:null, summary:'testing subscription form'},13 contactUpdate:{"name":{first:"firstName", middle:"middleName", last:"lastName"}, emails:[{tag:"main", email:"email@gmail.com"}]}14};15
16Wix.Activities.postActivity(activity, onSuccess, onFailure);
Cancel
Property | Type | Description |
---|---|---|
appointmentId (recommended) | String | The unique identifier of a scheduled appointment |
source (required) | "GUEST" or "STAFF" | Indicates who cancelled the appointment |
cancelDate (required) | DateTime | Reservation cancel date |
refund (required) | Object | Refund details |
refund.kind (required) | "FULL", "PARTIAL", or "NONE" | Type of refund |
refund.total (required) | Number | Total amount to refund |
refund.currency (required) | String | Refund currency code (i.e, EUR, USD, CAD) |
refund.notes | String | Notes about this refund |
refund.destination (required) | String | Refund's destination (credit card, cash, etc) |
title (required) | String | Appointment's title |
description (required) | String | Appointment's description |
infoLink | String | URL for more details about the appointment |
price | Object | Appointment’s price |
price.price (required) | Number | Price amount |
price.formattedPrice | String | Price format (i.e, €0,99 or $0.99) |
price.currency (required) | String | Currency code (i.e, EUR, USD, CAD) |
location | Object | Appointment's location |
location.address | String | Address |
location.city | String | City |
location.region | String | Region |
location.postalCode | String | Postal Code |
location.country | String | Country |
location.url | String | Location URL |
time | Object | Appointment’s scheduled time |
time.start (required) | DateTime | Scheduled start time |
time.end (required) | DateTime | Scheduled end time |
time.timeZone (required) | String | Scheduled time zone |
attendees | Array[object] | Appointment's attendees |
attendees.contactId | String | Attendee's contact ID |
attendees.name | Object | Attendee's name |
attendees.name.prefix | String | Name prefix |
attendees.name.first | String | First name |
attendees.name.middle | String | Middle name |
attendees.name.last | String | Last name |
attendees.name.suffix | String | Name suffix |
attendees.phone | String | Attendee's phone |
attendees.email | String | Attendee's email |
attendees.notes | String | Attendee's notes (like allergies or other restrictions) |
attendees.self | Boolean | True if the Wix user who scheduled the appointment will attend |
Get the Cancel Appointment Activity JSON.
Example
1var activity = {2 type:Wix.Activities.Type.SCHEDULER_CANCEL,3 info: { appointmentId: '455',4 source:'GUEST',5 cancelDate: '2013-07-01T08:07:40.802Z',6 refund: {kind: 'FULL', total: 100, currency:'USD'},7 title: 'AppointmentTitle',8 description: 'AppointmentDescription',9 infoLink: 'LinkToAppointment',10 price: {price: 100, formattedPrice:'Price', currency:'USD'},11 location: {address: 'address', city: 'NY', country: 'USA'},12 time: {start:'2013-07-01T08:07:40.802Z', end:'2013-07-01T08:07:40.802Z', timezone:'US Eastern Standard Time'},13 attendees: [{contactId:'ID', name: {first:'firstName', middle:'middleName', last:'lastName'}, phone: 'phoneNumber', email: 'email@gmail.com'}]},14 details:{additionalInfoUrl:null, summary:''},15 contactUpdate:{"name":{first:"firstName", middle:"middleName", last:"lastName"}, emails:[{tag:"main", email:"email@gmail.com"}]}16};17
18Wix.Activities.postActivity(activity, onSuccess, onFailure);
Social
Use the following activities to track social actions that occur in your app – for example, when a site visitor comments on the site, likes an Instagram photo, or posts a comment through Facebook:
- Comment: when a site visitor posts a comment on the site – whether the comment is posted on the site only, or also posted to the visitor’s social media page through a plugin on the site.
- Share-url: when a site visitor shares an item (like a blog post or photo) on social media.
- Track: when a site visitor takes one of these social media actions on the user’s channel: like, follow, subscribe, pin.
Comment
Property | Type | Description |
---|---|---|
text (required) | String | Comment text |
channel (required) | "SITE", "FACEBOOK", "TWITTER", "LINKEDIN", "GOOGLE_PLUS", "PINTEREST", "INSTAGRAM", "TUMBLR", "BLOGGER", "WORDPRESS", or "OTHER" | Where the comment was posted. SITE refers to the Wix site |
metadata | Array[object] | Additional information about the comment |
metadata.name (required) | String | Metadata property name |
metadata.value (required) | String | Metadata value |
commenter | Object | Details about the site visitor who made the comment |
commenter.openId | Object | How the site visitor was authenticated. Read more about openId. |
commenter.openId.channel (required) | "FACEBOOK", "TWITTER", "LINKEDIN", "GOOGLE_PLUS", "PINTEREST", "INSTAGRAM", "TUMBLR", "BLOGGER", "WORDPRESS", or "OTHER" | Account used to authenticate the site visitor |
commenter.name | Object | Site visitor's name |
commenter.name.prefix | String | Name prefix |
commenter.name.first | String | First name |
commenter.name.middle | String | Middle name |
commenter.name.last | String | Last name |
commenter.name.suffix | String | Name suffix |
commenter.email | String | Site visitor's email |
Get the Comment Activity JSON.
Example:
1var activity = {2 type:Wix.Activities.Type.SOCIAL_COMMENT,3 info: { text: 'social text',4 channel:'FACEBOOK',5 metadata: [{name:'metadata name', value: 'meta data value'}],6 commenter:{openId:{channel:'FACEBOOK'},name:{first:'firstName', middle:'middleName', last:'lastName'},email:'email@gmail.com'},7 details:{additionalInfoUrl:null, summary:'testing social activity'},8 contactUpdate:{"name":{first:"firstName", middle:"middleName", last:"lastName"}, emails:[{tag:"main", email:"email@gmail.com"}]}9};10
11var onSuccess = function(d){console.log("Activity ID: " + d.activityId + ", Contact ID: " + d.contactId)};12var onFailure = function(d){console.log("Failure message:" + d)};13Wix.Activities.postActivity(activity, onSuccess, onFailure);
Share-url
Property | Type | Description |
---|---|---|
channel (required) | "FACEBOOK", "TWITTER", "LINKEDIN", "GOOGLE_PLUS", "PINTEREST", "INSTAGRAM", "TUMBLR", "BLOGGER", "WORDPRESS", "SITE" or "OTHER" | Where the link was shared |
itemInfo (required) | Object | Details about the item or page the site visitor tracked |
itemInfo.itemUrl (required) | String | URL of the social media item |
itemInfo.ItemThumbnail | String | ImageId of the item's thumbnail image |
itemInfo.ItemId (required) | String | ID of this item |
itemInfo.ItemType (required) | "IMAGE", "VIDEO", "TEXT", "SITE", "ALBUM", or "PAGE" | Type of social media item |
1var activity = {2 type:Wix.Activities.Type.SOCIAL_SHARE_URL,3 info: {channel: 'FACEBOOK',4 itemInfo: {itemUrl : 'http://www.facebook.com/wix/', itemId : '1', itemType : 'PAGE'}},5 details:{additionalInfoUrl:'http://www.wix.com/my-account/app/{app-def-id}/{instance-id}/{app-related-deep-link', summary:""},contactUpdate:null};6
7var onSuccess = function(d){console.log("Activity ID: " + d.activityId + ", Contact ID: " + d.contactId)};8var onFailure = function(d){console.log("Failure message:" + d)};9Wix.Activities.postActivity(activity, onSuccess, onFailure);
Track
Property | Type | Description |
---|---|---|
type (required) | "LIKE", "FOLLOW", "SUBSCRIBE", "PIN_IT", "FAVORITE", "LOVE", "STAR", "OTHER" | Social media action taken by the site visitor |
channel (required) | "FACEBOOK", "TWITTER", "LINKEDIN", "GOOGLE_PLUS", "PINTEREST", "INSTAGRAM", "TUMBLR", "BLOGGER", "WORDPRESS", "SITE" or "OTHER" | Social media channel that contains the item the site visitor tracked |
itemInfo (required) | Object | Details about the item or page the site visitor tracked |
itemInfo.itemUrl (required) | String | URL of the social media item |
itemInfo.ItemThumbnail | String | ImageId of the item's thumbnail image |
itemInfo.ItemId (required) | String | ID of this item |
itemInfo.ItemType (required) | "IMAGE", "VIDEO", "TEXT", "SITE", "ALBUM", or "PAGE" | Type of social media item |
1var activity = {2 type:Wix.Activities.Type.SOCIAL_TRACK,3 info: {type: 'LIKE',4 channel: 'FACEBOOK',5 itemInfo: {itemUrl : 'http://www.facebook.com/wix/', itemId : '1', itemType : 'PAGE'}}, details: {additionalInfoUrl:'http://www.wix.com/my-account/app/{app-def-id}/{instance-id}/{app-related-deep-link}', summary:''},contactUpdate:null};6
7var onSuccess = function(d){console.log("Activity ID: " + d.activityId + ", Contact ID: " + d.contactId)};8var onFailure = function(d){console.log("Failure message:" + d)};9Wix.Activities.postActivity(activity, onSuccess, onFailure);
Hotels
Use the following activities for hospitality events in your app:
- Purchase: When a site visitor purchases a service offered by the hotel.
- Purchase-Failed: When the purchase of a hotel service could not be completed.
- Reservation: When a site visitor reserves a hotel room.
- Confirmation: When a reservation is confirmed.
- Cancel: When a reservation is canceled.
Purchase
Property | Type | Description |
---|---|---|
reservationId | String | Reservation ID |
guests (required) | Object | Guests details |
guests.total (required) | Number | Number of guests |
guests.adults (required) | Number | Number of adult guests |
guests.children (required) | Number | Number of child guests |
stay (required) | Object | Stay dates |
stay.checkin (required) | DateTime | Checkin date |
stay.checkout (required) | DateTime | Checkout date |
rates (required) | Array[object] | Rate details |
rates.date (required) | DateTime | Rate date |
rates.subtotal (required) | Number | Subtotal amount (without taxes) |
rates.taxes (required) | Array[object] | Tax details |
rates.taxes.name (required) | String | Tax name (occupancy tax, resort fee, etc) |
rates.taxes.total (required) | Number | Tax total amount |
rates.taxes.currency (required) | String | Tax currency code (i.e, EUR, USD, CAD) |
rates.total (required) | Number | Total amount |
rates.currency (required) | String | Rate currency code (i.e, EUR, USD, CAD) |
payment (required) | Object | Payment details |
payment.subtotal (required) | Number | Payment subtotal |
payment.total (required) | Number | Payment total |
payment.currency (required) | String | Payment currency code (i.e, EUR, USD, CAD) |
payment.source (required) | String | Payment method (cash, credit, paypal, etc) |
customer | Object | Customer details |
customer.contactId | String | Customer’s contact ID |
customer.isGuest | Boolean | true if the customer a returning guest |
customer.name | Object | Customer's name |
customer.name.prefix | String | Name prefix |
customer.name.first | String | First name |
customer.name.middle | String | Middle name |
customer.name.last | String | Last name |
customer.name.suffix | String | Name suffix |
customer.phone | String | Customer's phone number |
customer.email | String | Customer's email |
rooms (required) | Array[object] | Room details |
rooms.id | String | Room ID |
rooms.beds (required) | Array[object] | Room's bed list |
kind (required) | String | Type of bed |
kind.maxOccupancy (required) | Number | Room's occupancy number |
kind.amenities (required) | Array[string] | List of amenities reserved |
Get the Purchase Activity JSON.
Example:
1var activity = {2 type:Wix.Activities.Type.HOTELS_PURCHASE,3 info: { reservationId: '455', guests:{ total: 1, adults: 1, children: 0},stay: { checkin: new Date(new Date().getTime() - (60 * 60 * 24)), checkout: new Date().toISOString() },rates:[{ date: new Date(new Date().getTime() - (60 * 60 * 24)), subtotal: 22.4, taxes: [ {name: 'stuff', total: 0.6, currency: 'USD'} ], total: 30, currency: 'USD'}],payment: {total: '1', subtotal: '1', currency: 'EUR', source: 'Cash'},customer: {contactId: '123', isGuest:true, name:{ prefix: 'Mr',first: 'Kanye', middle: 'k', last:'West', suffix:'The king'},phone: '1234567',email:'email@email.com'} , rooms:[{ id: 'single123', beds: [ {kind:'king'} ], maxOccupancy: 3, amenities: [ 'air conditioning', 'wifi', 'cable', 'goats']}] },4 details:{additionalInfoUrl:null, summary:''},5 contactUpdate:{"name":{first:"firstName", middle:"middleName", last:"lastName"}, emails:[{tag:"main", email:"email@gmail.com"}]}6}7
8Wix.Activities.postActivity(activity, onSuccess, onFailure);
Purchase-failed
Property | Type | Description |
---|---|---|
reservationId | String | Reservation ID |
guests (required) | Object | Guests details |
guests.total (required) | Number | Number of guests |
guests.adults (required) | Number | Number of adult guests |
guests.children (required) | Number | Number of child guests |
stay (required) | Object | Stay dates |
stay.checkin (required) | DateTime | Checkin date |
stay.checkout (required) | DateTime | Checkout date |
rates (required) | Array[object] | Rate details |
rates.date (required) | DateTime | Rate date |
rates.subtotal (required) | Number | Subtotal amount (without taxes) |
rates.taxes (required) | Array[object] | Tax details |
rates.taxes.name (required) | String | Tax name (occupancy tax, resort fee, etc) |
rates.taxes.total (required) | Number | Tax total amount |
rates.taxes.currency (required) | String | Tax currency code (i.e, EUR, USD, CAD) |
rates.total (required) | Number | Total amount |
rates.currency (required) | String | Rate currency code (i.e, EUR, USD, CAD) |
payment (required) | Object | Payment details |
payment.subtotal (required) | Number | Payment subtotal |
payment.total (required) | Number | Payment total |
payment.currency (required) | String | Payment currency code (i.e, EUR, USD, CAD) |
payment.source (required) | String | Payment method (cash, credit, paypal, etc) |
payment.error | Object | Details for payment error |
payment.error.errorCode | Number | Error code |
payment.error.reason | String | Reason why the payment failed |
customer | Object | Customer details |
customer.contactId | String | Customer’s contact ID |
customer.isGuest | Boolean | true if the customer a returning guest |
customer.name | Object | Customer's name |
customer.name.prefix | String | Name prefix |
customer.name.first | String | First name |
customer.name.middle | String | Middle name |
customer.name.last | String | Last name |
customer.name.suffix | String | Name suffix |
customer.phone | String | Customer's phone number |
customer.email | String | Customer's email |
rooms (required) | Array[object] | Room details |
rooms.id | String | Room ID |
rooms.beds (required) | Array[object] | Room's bed list |
kind (required) | String | Type of bed |
kind.maxOccupancy (required) | Number | Room's occupancy number |
kind.amenities (required) | Array[string] | List of amenities reserved |
Get the Purchased-Failed Activity JSON.
Example:
1var activity = {2 type:Wix.Activities.Type.HOTELS_PURCHASE_FAILED,3 info: { reservationId: '455', guests:{ total: 1, adults: 1, children: 0},stay: { checkin: new Date(new Date().getTime() - (60 * 60 * 24)), checkout: new Date().toISOString() },rates:[{ date: new Date(new Date().getTime() - (60 * 60 * 24)), subtotal: 22.4, taxes: [ {name: 'stuff', total: 0.6, currency: 'USD'} ], total: 30, currency: 'USD'}],payment: {total: '1', subtotal: '1', currency: 'EUR', source: 'Cash', error:{errorCode:'123', reason:'out of date'} },customer: {contactId: '123', isGuest:true, name:{ prefix: 'Mr',first: 'Kanye', middle: 'k', last:'West', suffix:'The king'},phone: '1234567',email:'email@email.com'} , rooms:[{ id: 'single123', beds: [ {kind:'king'} ], maxOccupancy: 3, amenities: [ 'air conditioning', 'wifi', 'cable', 'goats']}] },4 details:{additionalInfoUrl:null, summary:''},5 contactUpdate:{"name":{first:"firstName", middle:"middleName", last:"lastName"}, emails:[{tag:"main", email:"email@gmail.com"}]}6}7
8Wix.Activities.postActivity(activity, onSuccess, onFailure);
Confirmation and Reservation
Property | Type | Description |
---|---|---|
source (required) | "GUEST" or "STAFF" | Indicates who confirmed/reserved the room. |
reservationId | String | Reservation ID |
guests (required) | Object | Guests details |
guests.total (required) | Number | Number of guests |
guests.adults (required) | Number | Number of adult guests |
guests.children (required) | Number | Number of child guests |
stay (required) | Object | Stay dates |
stay.checkin (required) | DateTime | Checkin date |
stay.checkout (required) | DateTime | Checkout date |
rates (required) | Array[object] | Rate details |
rates.date (required) | DateTime | Rate date |
rates.subtotal (required) | Number | Subtotal amount (without taxes) |
rates.taxes (required) | Array[object] | Tax details |
rates.taxes.name (required) | String | Tax name (occupancy tax, resort fee, etc) |
rates.taxes.total (required) | Number | Tax total amount |
rates.taxes.currency (required) | String | Tax currency code (i.e, EUR, USD, CAD) |
rates.total (required) | Number | Total amount |
rates.currency (required) | String | Rate currency code (i.e, EUR, USD, CAD) |
invoice (required) | Object | Reservation invoice details |
invoice.subtotal (required) | Number | Invoice subtotal |
invoice.total (required) | Number | Invoice total |
invoice.currency (required) | String | Invoice currency code (i.e, EUR, USD, CAD) |
customer | Object | Customer details |
customer.contactId | String | Customer’s contact ID |
customer.isGuest | Boolean | true if the customer a returning guest |
customer.name | Object | Customer's name |
customer.name.prefix | String | Name prefix |
customer.name.first | String | First name |
customer.name.middle | String | Middle name |
customer.name.last | String | Last name |
customer.name.suffix | String | Name suffix |
customer.phone | String | Customer's phone number |
customer.email | String | Customer's email |
rooms (required) | Array[object] | Room details |
rooms.id | String | Room ID |
rooms.beds (required) | Array[object] | Room's bed list |
kind (required) | String | Type of bed |
kind.maxOccupancy (required) | Number | Room's occupancy number |
kind.amenities (required) | Array[string] | List of amenities reserved |
Get the Confirmation and the Reservation Activity JSON.
RESERVATION
1var activity = {2 type:Wix.Activities.Type.HOTELS_RESERVATION,3 info: {source:'GUEST' , reservationId: '455', guests:{ total: 1, adults: 1, children: 0},stay: { checkin: new Date(new Date().getTime() - (60 * 60 * 24)), checkout: new Date().toISOString() },rates:[{ date: new Date(new Date().getTime() - (60 * 60 * 24)), subtotal: 22.4, taxes: [ {name: 'stuff', total: 0.6, currency: 'USD'} ], total: 30, currency: 'USD'}], invoice:{subtotal: 20, total:30, currency:"UDS"},customer: {contactId: '123', isGuest:true, name:{ prefix: 'Mr',first: 'Kanye', middle: 'k', last:'West', suffix:'The king'},phone: '1234567',email:'email@email.com'} , rooms:[{ id: 'single123', beds: [ {kind:'king'} ], maxOccupancy: 3, amenities: [ 'air conditioning', 'wifi', 'cable', 'goats']}] },4 details:{additionalInfoUrl:null, summary:''},5 contactUpdate:{"name":{first:"firstName", middle:"middleName", last:"lastName"}, emails:[{tag:"main", email:"email@gmail.com"}]}6}7
8Wix.Activities.postActivity(activity, onSuccess, onFailure);
CONFIRMATION
1var activity = {2 type:Wix.Activities.Type.HOTELS_CONFIRMATION,3 info: {source:"GUEST" , reservationId: '455', guests:{ total: 1, adults: 1, children: 0},stay: { checkin: new Date(new Date().getTime() - (60 * 60 * 24)), checkout: new Date().toISOString() },rates:[{ date: new Date(new Date().getTime() - (60 * 60 * 24)), subtotal: 22.4, taxes: [ {name: 'stuff', total: 0.6, currency: 'USD'} ], total: 30, currency: 'USD'}], invoice:{subtotal: 20, total:30, currency:"UDS"},customer: {contactId: '123', isGuest:true, name:{ prefix: 'Mr',first: 'Kanye', middle: 'k', last:'West', suffix:'The king'},phone: '1234567',email:'email@email.com'} , rooms:[{ id: 'single123', beds: [ {kind:'king'} ], maxOccupancy: 3, amenities: [ 'air conditioning', 'wifi', 'cable', 'goats']}] },4 details:{additionalInfoUrl:null, summary:'testing hotel confirmation'},5 contactUpdate:{"name":{first:"firstName", middle:"middleName", last:"lastName"}, emails:[{tag:"main", email:"email@gmail.com"}]}6}7
8Wix.Activities.postActivity(activity, onSuccess, onFailure);
Cancel
Property | Type | Description |
---|---|---|
cancelDate (required) | DateTime | Reservation cancel date |
refund (required) | Object | Refund details |
refund.kind (required) | "FULL", "PARTIAL", or "NONE" | Type of refund |
refund.total (required) | Number | Total amount to refund |
refund.currency (required) | String | Refund currency code (i.e, EUR, USD, CAD) |
refund.notes | String | Notes about this refund |
refund.destination (required) | String | Refund's destination (credit card, cash, etc) |
reservationId | String | Reservation ID |
guests (required) | Object | Guests details |
guests.total (required) | Number | Number of guests |
guests.adults (required) | Number | Number of adult guests |
guests.children (required) | Number | Number of child guests |
stay (required) | Object | Stay dates |
stay.checkin (required) | DateTime | Checkin date |
stay.checkout (required) | DateTime | Checkout date |
rates (required) | Array[object] | Rate details |
rates.date (required) | DateTime | Rate date |
rates.subtotal (required) | Number | Subtotal amount (without taxes) |
rates.taxes (required) | Array[object] | Tax details |
rates.taxes.name (required) | String | Tax name (occupancy tax, resort fee, etc) |
rates.taxes.total (required) | Number | Tax total amount |
rates.taxes.currency (required) | String | Tax currency code (i.e, EUR, USD, CAD) |
rates.total (required) | Number | Total amount |
rates.currency (required) | String | Rate currency code (i.e, EUR, USD, CAD) |
invoice (required) | Object | Reservation invoice details |
invoice.subtotal (required) | Number | Invoice subtotal |
invoice.total (required) | Number | Invoice total |
invoice.currency (required) | String | Invoice currency code (i.e, EUR, USD, CAD) |
customer | Object | Customer details |
customer.contactId | String | Customer’s contact ID |
customer.isGuest | Boolean | true if the customer a returning guest |
customer.name | Object | Customer's name |
customer.name.prefix | String | Name prefix |
customer.name.first | String | First name |
customer.name.middle | String | Middle name |
customer.name.last | String | Last name |
customer.name.suffix | String | Name suffix |
customer.phone | String | Customer's phone number |
customer.email | String | Customer's email |
rooms (required) | Array[object] | Room details |
rooms.id | String | Room ID |
rooms.beds (required) | Array[object] | Room's bed list |
kind (required) | String | Type of bed |
kind.maxOccupancy (required) | Number | Room's occupancy number |
kind.amenities (required) | Array[string] | List of amenities reserved |
Get the Cancel Activity JSON.
Example:
1var activity = {2 type:Wix.Activities.Type.HOTELS_CANCEL,3 info: {cancelDate: new Date().toISOString() ,refund: {kind:'FULL', total:100, currency:'USD', notes:'too expensive', destination:'Tel Aviv'} ,reservationId: '455', guests:{ total: 1, adults: 1, children: 0},stay: { checkin: new Date(new Date().getTime() - (60 * 60 * 24)), checkout: new Date().toISOString() },rates:[{ date: new Date(new Date().getTime() - (60 * 60 * 24)), subtotal: 22.4, taxes: [ {name: 'stuff', total: 0.6, currency: 'USD'} ], total: 30, currency: 'USD'}], invoice:{subtotal: 20, total:30, currency:"UDS"},customer: {contactId: '123', isGuest:true, name:{ prefix: 'Mr',first: 'Kanye', middle: 'k', last:'West', suffix:'The king'},phone: '1234567',email:'email@email.com'} , rooms:[{ id: 'single123', beds: [ {kind:'king'} ], maxOccupancy: 3, amenities: [ 'air conditioning', 'wifi', 'cable', 'goats']}] },4 details:{additionalInfoUrl:null, summary:''},5 contactUpdate:{"name":{first:"firstName", middle:"middleName", last:"lastName"}, emails:[{tag:"main", email:"email@gmail.com"}]}6}7
8Wix.Activities.postActivity(activity, onSuccess, onFailure);
Music
Use the following activities for music events in your app:
- Track-Play: When a request to start playing a song is made
- Track-Skip: When a track was skipped
- Track-Played: When a song has completed its run
- Track-Lyrics: When the track lyrics are requested
- Track-Share: When a track is shared using the app
- Album-Share: When an album is shared through your app
- Album-Fan: When a visitor becomes a fan of an album
- Album-Played: When an album has completed its run
Track-Play, Track-Skip, Track-Played, and Track-Lyrics
Property | Type | Description |
---|---|---|
track (required) | Object | Track details |
track.name (required) | String | Track name |
track.id | String | Track ID |
album (required) | Object | Album details |
album.name (required) | String | Album name |
album.id | String | Album ID |
artist | Object | Artist details |
artist.name (required) | String | Artist name |
artist.id | String | Artist ID |
Get the Track-Play, Track-Skip, Track-Played, and Track-Lyrics Activity JSON.
TRACK-PLAY
1var activity = {2 type:Wix.Activities.Type.TRACK_PLAY,3 info: { track:{name: 'Stronger', id:'123'}, album: {name:'Graduation', id:'123'}, artist:{name:'Kanye West', id:'123'}},4 details:{additionalInfoUrl:null, summary:''},5 contactUpdate:{}6}7
8Wix.Activities.postActivity(activity, onSuccess, onFailure);
TRACK-SKIP
1var activity = {2 type:Wix.Activities.Type.TRACK_SKIP,3 info: { track:{name: 'Stronger', id:'123'}, album: {name:'Graduation', id:'123'}, artist:{name:'Kanye West', id:'123'}},4 details:{additionalInfoUrl:null, summary:'testing track skip'},5 contactUpdate:{}6}7
8Wix.Activities.postActivity(activity, onSuccess, onFailure);
TRACK-PLAYED
1var activity = {2 type:Wix.Activities.Type.TRACK_PLAYED,3 info: { track:{name: 'Stronger', id:'123'}, album: {name:'Graduation', id:'123'}, artist:{name:'Kanye West', id:'123'}},4 details:{additionalInfoUrl:null, summary:'testing track played'},5 contactUpdate:{}6}7
8Wix.Activities.postActivity(activity, onSuccess, onFailure);
TRACK-LYRICS
1var activity = {2 type:Wix.Activities.Type.TRACK_LYRICS,3 info: { track:{name: 'Stronger', id:'123'}, album: {name:'Graduation', id:'123'}, artist:{name:'Kanye West', id:'123'}},4 details:{additionalInfoUrl:null, summary:'testing track lyrics'},5 contactUpdate:{}6}7
8Wix.Activities.postActivity(activity, onSuccess, onFailure);
Track-Share
Property | Type | Description |
---|---|---|
track (required) | Object | Track details |
track.name (required) | String | Track name |
track.id | String | Track ID |
album (required) | Object | Album details |
album.name (required) | String | Album name |
album.id | String | Album ID |
artist | Object | Artist details |
artist.name (required) | String | Artist name |
artist.id | String | Artist ID |
sharedTo (required) | "FACEBOOK", "GOOGLE_PLUS", "TWITTER", "BLOGGER", or "TUMBLR" | Where item was shared |
Get the Track-Share Activity JSON.
Example:
1var activity = {2 type:Wix.Activities.Type.TRACK_SHARE,3 info: { track:{name: 'Stronger', id:'123'}, album: {name:'Graduation', id:'123'}, artist:{name:'Kanye West', id:'123'},sharedTo:'FACEBOOK'},4 details:{additionalInfoUrl:null, summary:''},5 contactUpdate:{}6}7
8Wix.Activities.postActivity(activity, onSuccess, onFailure);
Album-Share
Property | Type | Description |
---|---|---|
album (required) | Object | Album details |
album.name (required) | String | Album name |
album.id | String | Album ID |
artist | Object | Artist details |
artist.name (required) | String | Artist name |
artist.id | String | Artist ID |
sharedTo (required) | "FACEBOOK", "GOOGLE_PLUS", "TWITTER", "BLOGGER", or "TUMBLR" | Where item was shared |
Get the Album-Share Activity JSON.
Example:
1var activity = {2 type:Wix.Activities.Type.ALBUM_SHARE,3 info: {album: {name:'Graduation', id:'123'}, artist:{name:'Kanye West', id:'123'}, sharedTo:'FACEBOOK',4 details:{additionalInfoUrl:null, summary:''},5 contactUpdate:{}6}7
8Wix.Activities.postActivity(activity, onSuccess, onFailure);
Album-Fan and Album-Played
album (required) | Object | Album details |
album.name (required) | String | Album name |
album.id | String | Album ID |
artist | Object | Artist details |
artist.name (required) | String | Artist name |
artist.id | String | Artist ID |
Get the Album-Fan and the Album-Played Activity JSON.
ALBUM-FAN
1var activity = {2 type:Wix.Activities.Type.ALBUM_FAN,3 info: {album: {name:'Graduation', id:'123'}, artist:{name:'Kanye West', id:'123'}},4 details:{additionalInfoUrl:null, summary:''},5 contactUpdate:{}6}7
8Wix.Activities.postActivity(activity, onSuccess, onFailure);
ALBUM-PLAYED
1var activity = {2 type:Wix.Activities.Type.ALBUM_PLAYED,3 info: {album: {name:'Graduation', id:'123'}, artist:{name:'Kanye West', id:'123'}},4 details:{additionalInfoUrl:null, summary:'testing music track played'},5 contactUpdate:{"name":{first:"firstName", middle:"middleName", last:"lastName"}, emails:[{tag:"main", email:"email@gmail.com"}]}6}7
8Wix.Activities.postActivity(activity, onSuccess, onFailure);
eCommerce
Use the following activities for eCommerce events in your app:
- Cart-add: An item was added to the cart.
- Cart-remove: An item was removed from the cart.
- Cart-abandon: A cart with these items was abandoned.
- Cart-checkout: A checkout process has begun with this cart.
- Purchase: The checkout process has completed.
Note: Does your app rely on getting eCommerce activities that happened in the site? Keep in mind that Wix’s eCommerce app, WixStores, currently posts only the purchase activity.
Cart-add and Cart-remove
|Property|Type|Description|
|---|---|---|
|cartId (required)|String|Cart ID|
|storeId (required)|String|Store ID |
|storeName|String|Name of store|
|item (required)|Array[object]|Item added/removed from cart|
|item.id (required)|String|Item ID|
|item.type|"PHYSICAL" or "DIGITAL"|Item type|
|item.sku|String|Item SKU number|
|item.title (required)|String|Item's title|
|item.quantity (required)|Integer|Item's quantity|
|item**.price|Number|Item's price|
|item.formattedPrice|String|Price format (i.e, €0,99 or $0.99)|
|item.currency (required)|String|Currency code (i.e, EUR, USD, CAD)|
|item.productLink |String|Item's link|
|item.weight|Number|Item's weight|
|item.formattedWeight|String|Weight format|
|item.media|Object|Media details for this item (like a photo)|
|item.media.thumbnail|String|Link to the thumbnail |
|item.variants (required)|Array[object]|Item's variants (like a specific color or size)|
|item.variants.title (required)|String|Variant title|
|item.variants.value|String|Variant value|
|item.categories|Array[string]|Item's categories (such as shirt, summer sale, etc.)|
|item.metadata|Array[object]|Additional information about this item|
|item.metadata.name (required)|String|Metadata name|
|item.metadata.value (required)|String|Metadata value|
Get the Cart-add JSON and the Cart-remove JSON.
CART-ADD
1var activity = {2 type:Wix.Activities.Type.ECOMMERCE_CART_ADD,3 info:{cartId: '11111', storeId: '11111', storeName: 'WixStore', item:{ id: 1, type:'PHYSICAL', sku: 'sky', title: 'title',4 quantity: 1, price: '1', formattedPrice: '1.1',5 currency: 'EUR', productLink: 'link', weight: '1',6 formattedWeight: '1.0KG', media: {thumbnail: 'PIC'},7 categories: ['shirt','clothing','wix'],8 metadata: [ {name: "item", value: "1"} ],9 variants: [{title: 'title', value: '1'}]}},10 details:{additionalInfoUrl:null, summary:''},11 contactUpdate:{"name":{first:"firstName", middle:"middleName", last:"lastName"}, emails:[{tag:"main", email:"email@gmail.com"}]}12}13
14Wix.Activities.postActivity(activity, onSuccess, onFailure);
CART-REMOVE
1var activity = {2 type:Wix.Activities.Type.ECOMMERCE_CART_REMOVE,3 info:{cartId: '11111', storeId: '11111', storeName: 'WixStore', item:{ id: 1, type:'PHYSICAL', sku: 'sky', title: 'title',4 quantity: 1, price: '1', formattedPrice: '1.1',5 currency: 'EUR', productLink: 'link', weight: '1',6 formattedWeight: '1.0KG', media: {thumbnail: 'PIC'},7 categories: ['shirt','clothing','wix'],8 metadata: [ {name: "item", value: "1"} ],9 variants: [{title: 'title', value: '1'}]}},10 details:{additionalInfoUrl:null, summary:'testing cart remove'},11 contactUpdate:{"name":{first:"firstName", middle:"middleName", last:"lastName"}, emails:[{tag:"main", email:"email@gmail.com"}]}12}13
14Wix.Activities.postActivity(activity, onSuccess, onFailure);
Cart-abandon and Cart-checkout
|Property |Type |Description|
|---|---|---|
|cartId (required)|String|Cart ID|
|storeId (required)|String|Store ID |
|storeName|String|Name of store|
|items (required)|Array[object]|Items in cart|
|items.id (required)|String|Item ID|
|items.type|"PHYSICAL" or "DIGITAL"|Item type|
|items.sku|String|Item SKU number|
|items.title (required)|String|Item's title|
|items.quantity (required)|Integer|Item's quantity|
|items**.price|Number|Item's price|
|items.formattedPrice|String|Price format (i.e, €0,99 or $0.99)|
|items.currency (required)|String|Currency code (i.e, EUR, USD, CAD)|
|items.productLink |String|Item's link|
|items.weight|Number|Item's weight|
|items.formattedWeight|String|Weight format|
|items.media|Object|Media details for this item (like a photo)|
|items.media.thumbnail|String|Link to the thumbnail |
|items.variants (required)|Array[object]|Item's variants (like a specific color or size)|
|items.variants.title (required)|String|Variant title|
|items.variants.value|String|Variant value|
|items.categories|Array[string]|Item's categories (such as shirt, summer sale, etc.)|
|items.metadata|Array[object]|Additional information about this item|
|items.metadata.name (required)|String|Metadata name|
|items.metadata.value (required)|String|Metadata value|
Get the Cart-abandon JSON and the Cart-checkout JSON.
CART-CHECKOUT
1var activity = {2 type:Wix.Activities.Type.ECOMMERCE_CART_CHECKOUT,3 info:{cartId: '11111', storeId: '11111', storeName: 'WixStore', items:[{ id: 1, type:'PHYSICAL', sku: 'sky', title: 'title',4 quantity: 1, price: '1', formattedPrice: '1.1',5 currency: 'EUR', productLink: 'link', weight: '1',6 formattedWeight: '1.0KG', media: {thumbnail: 'PIC'},7 categories: ['shirt','clothing','wix'],8 metadata: [ {name: "item", value: "1"} ],9 variants: [{title: 'title', value: '1'}]}]},10 details:{additionalInfoUrl:null, summary:''},11 contactUpdate:{"name":{first:"firstName", middle:"middleName", last:"lastName"}, emails:[{tag:"main", email:"email@gmail.com"}]}12}13
14Wix.Activities.postActivity(activity, onSuccess, onFailure);
CART-ABANDON
1var activity = {2 type:Wix.Activities.Type.ECOMMERCE_CART_ABANDON,3 info:{cartId: '11111', storeId: '11111', storeName: 'WixStore', items:[{ id: 1, type:'PHYSICAL', sku: 'sky', title: 'title',4 quantity: 1, price: '1', formattedPrice: '1.1',5 currency: 'EUR', productLink: 'link', weight: '1',6 formattedWeight: '1.0KG', media: {thumbnail: 'PIC'},7 categories: ['shirt','clothing','wix'],8 metadata: [ {name: "item", value: "1"} ],9 variants: [{title: 'title', value: '1'}]}]},10 details:{additionalInfoUrl:null, summary:'testing music track played'},11 contactUpdate:{"name":{first:"firstName", middle:"middleName", last:"lastName"}, emails:[{tag:"main", email:"email@gmail.com"}]}12}13
14Wix.Activities.postActivity(activity, onSuccess, onFailure);
Purchase
|Property |Type |Description|
|---|---|---|
|cartId (required)|String|Cart ID|
|storeId (required)|String|Store ID|
|storeName|String|Name of store|
|orderId (recommended)|String|Order ID|
|items (required)|Array[object]|Purchased items|
|items.id (required)|String|Item ID|
|items.type|"PHYSICAL" or "DIGITAL"|Item type|
|items.sku|String|Item SKU number|
|items.title (required)|String|Item's title|
|items.quantity (required)|Integer|Item's quantity|
|items**.price|Number|Item's price|
|items.formattedPrice|String|Price format (i.e, €0,99 or $0.99)|
|items.currency (required)|String|Currency code (i.e, EUR, USD, CAD)|
|items.productLink |String|Item's link|
|items.weight|Number|Item's weight|
|items.formattedWeight|String|Weight format|
|items.media|Object|Media details for this item (like a photo)|
|items.media.thumbnail|String|Link to the thumbnail |
|items.variants (required)|Array[object]|Item's variants (like a specific color or size)|
|items.variants.title (required)|String|Variant title|
|items.variants.value|String|Variant value|
|items.categories|Array[string]|Item's categories (such as shirt, summer sale, etc.)|
|items.metadata|Array[object]|Additional information about this item|
|items.metadata.name (required)|String|Metadata name|
|items.metadata.value (required)|String|Metadata value|
|payment (required)|Object|Payment details|
|payment.total (required)|Number|Payment total|
|payment.subTotal (required)|Number|Payment subtotal|
|payment.formattedTotal|String|Formatted total|
|payment.formattedSubTotal|String|Formatted subtotal|
|payment.currency (required)|String|Currency code (i.e, EUR, USD, CAD)|
|payment.coupon|Object|Coupon details|
|payment.coupon.total (required)|Number|Amount the coupon deducted from the total price|
|payment.coupon.FormattedTotal|String|Formatted coupon total|
|payment.coupon.title (required)|String|Coupon title|
|payment.tax|Object|Payment's tax details|
|payment.tax.total (required)|Number|Tax total|
|payment.tax.formattedTotal|String|Formatted tax total|
|payment.shipping|Object|Shipping details|
|payment.shipping.total (required)|Number|Shipping total|
|payment.shipping.formattedTotal|String|Formatted shipping total|
|shippingAddress|Object|Shipping address details|
|shippingAddress.firstName|String|Recipient's first name|
|shippingAddress.lastName|String|Recipient's last name|
|shippingAddress.email|String|Recipient's email|
|shippingAddress.phone|String|Recipient's phone|
|shippingAddress.country|String|Recipient's country|
|shippingAddress.countryCode|String|Recipient's country code|
|shippingAddress.region|String|Recipient's region|
|shippingAddress.regionCode|String|Recipient's region code|
|shippingAddress.city|String|Recipient's city|
|shippingAddress.address1|String|Recipient's address|
|shippingAddress.address2|String|Recipient's address, part 2|
|shippingAddress.zip|String|Recipient's postal code|
|shippingAddress.company|String|Recipient's company|
|billingAddress|Object|Billing address details|
|billingAddress.firstName|String|Buyer's first name|
|billingAddress.lastName|String|Buyer's last name|
|billingAddress.email|String|Buyer's email|
|billingAddress.phone|String|Buyer's phone|
|billingAddress.country|String|Buyer's country|
|billingAddress.countryCode|String|Buyer's country code|
|billingAddress.region|String|Buyer's region|
|billingAddress.regionCode|String|Buyer's region code|
|billingAddress.city|String|Buyer's city|
|billingAddress.address1|String|Buyer's address|
|billingAddress.address2|String|Buyer's address, part 2|
|billingAddress.zip|String|Buyer's postal code|
|billingAddress.company|String|Buyer's company|
|paymentGateway|String|Payment gateway name|
|note|String|Notes about the purchase|
|buyerAcceptsMarketing|Boolean|True if the buyer opts to receive marketing emails from the vendor|
Get the Purchase Activity JSON.
Example
1var activity = {2 type:Wix.Activities.Type.ECOMMERCE_PURCHASE,3 info:{4 cartId:'123', storeId:'123', storeName:'Wix', orderId:'123', 5 items:[{ 6 id: 1, type:'PHYSICAL', sku: 'sky', title: 'title',7 quantity: 1, price: '1', formattedPrice: '1.1',8 currency: 'EUR', productLink: 'link', weight: '1',9 formattedWeight: '1.0KG', media: {thumbnail: 'PIC'},10 categories: ['shirt','clothing','wix'],11 metadata: [ {name: "item", value: "1"} ],12 variants: [{title: 'title', value: '1'}]13 }],14 payment:{15 total: '1', subtotal: '1', formattedTotal: '1.0', formattedSubtotal: '1.0', currency: 'EUR', 16 coupon: {total: '1', title: 'Dis'}, tax: {total: 1, formattedTotal: 1}, 17 shipping: {total: 1, formattedTotal: 1}},18 billingAddress: {19 firstName: 'Wix' , lastName: 'Cool',20 email: 'wix@example.com', phone: '12345566',21 city: 'Bitola', address1: 'Marshal Tito', address2: 'Marshal Tito',22 region: 'Bitola', regionCode: '7000',23 country: 'USA', countryCode: 'US',24 zip: '7000',25 company: 'Wix.com'26 }, 27 paymentGateway: 'PAYPAL',28 note: 'Note',29 buyerAcceptsMarketing: true 30 },31 details:{additionalInfoUrl:null, summary:''},32 contactUpdate:{"name":{first:"firstName", middle:"middleName", last:"lastName"}, emails:[{tag:"main", email:"email@gmail.com"}]}33}34
35Wix.Activities.postActivity(activity, onSuccess, onFailure);
Messaging
Use the following activity for chat and other messaging events in your app:
- im: when a chat/sms message is sent between a Wix user and a site visitor/contact.
im
Property | Type | Description |
---|---|---|
type (required) | ‘chat’ or ‘sms’ | Type of message: * chat - message sent to /received from the user’s site. * sms - message sent to / received from the user’s mobile phone |
content (required) | Array[objects] | Information about the message |
content.direction (required) | ‘BUSINESS_TO_CUSTOMER’, ‘CUSTOMER_TO_BUSINESS’ | Message direction: * BUSINESS_TO_CUSTOMER - the Wix user sent an message to the site visitor/contact. * CUSTOMER_TO_BUSINESS - the Wix user received an message from a site visitor/contact |
content.time (required) | DateTime | Time the message was sent, as an ISO 8601 timestamp |
content.message (required) | String | Message text |
content.media (required) | Array[objects] | Information about any media files sent in the message |
content.media.name (required) | String | Name of the media file |
content.media.contentType (required) | String | Type of media file, i.e: image, video, document |
content.media.url (required) | String | URL of the media file |
threadId | String | A ID for the conversation, to identify all messages that are part of this thread |
metadata | Array[objects] | Additional information about the chat |
name (required) | String | Metadata property name |
value (required) | String | Metadata value |
Get the im activity JSON.
Example
1var activity = {2 type: Wix.Activities.Type.MESSAGE_IM,3 info: { type:'CHAT', content: [{ direction: 'CUSTOMER_TO_BUSINESS', time: '2016-09-15T15:53:00', message: 'test message', media: [{name:'image',contentType:'image',url:'http://static.wixstatic.com/media/3cd1de924697419088c1e033bb3384ef.jpg'}] }]},4 details:{additionalInfoUrl:'http://www.wix.com/my-account/app/{app-def-id}/{instance-id}/{app-related-deep-link}', summary:""},5 contactUpdate:null6};7
8var onSuccess = function(d){console.log("Activity ID: " + d.activityId + ", Contact ID: " + d.contactId)};9var onFailure = function(d){console.log("Failure message:" + d)};10Wix.Activities.postActivity(activity, onSuccess, onFailure);
Events
Use the RSVP activity for RSVPs to events created by Wix users (like conferences, webinars, or parties).
RSVP
Property | Type | Description |
---|---|---|
eventId (required) | String | ID of the event |
eventTitle (required) | String | Name of the event |
eventDescription | String | Event description |
totalNumberAttendees | Number | How many guests will attend the event |
price | Object | Details about the event’s price |
price.price (required) | Number | Price |
price.currency (required) | String | Currency code (i.e, EUR, USD, CAD) |
price.formattedPrice | String | Price format (i.e, €0,99 or $0.99) |
location | Object | Location of the event |
location.name | String | Location name |
location.address (required) | String | Location address |
time | Object | The date & time of the event |
time.start (required) | Datetime | Scheduled start time |
time.end | Datetime | Scheduled end time |
time.timeZone (required) | String | Time zone |
Get the rsvp activity JSON.
Example
1var activity = {2 type: Wix.Activities.Type.EVENTS_RSVP,3 info: {4 eventId: '123456789123456789123456789123456789',5 eventTitle: 'my appointment',6 price: {7 price: '1',8 currency: 'USD',9 formattedPrice: '$1.00'10 },11 location: {12 address: '123 meep st.',13 },14 time: {15 start: new Date().toISOString(),16 end: new Date(new Date().getTime() + (60 * 60 * 24)).toISOString(),17 timeZone: 'ET'18 }19 },20 contactUpdate: {21 "name": {22 first: "firstName",23 middle: "middleName",24 last: "lastName"25 },26 emails: [{27 tag: "main",28 email: "email@gmail.com"29 }]30 }31}32
33Wix.Activities.postActivity(activity, function(res) { console.log(res) }, function(err) { console.log(err) });
Deprecated
- The EVENTS_EVENT_UPDATE activity is now deprecated. Use the updated RSVP activity instead.
- The CONTACT_CONTACT_FORM activity is deprecated. Use the updated contact-form activity or our new form activity (for other types of forms), instead.
- The CONTACT_SUBSCRIPTION_FORM activity is now deprecated. Use the updated subscription-form activity instead.
- The SEND_MESSAGE activity is deprecated. Use the IM activity instead.