About Social Media

The Social Media API allows you to track when a loyalty customer follows a social media channel. After following a social media channel, the customer's loyalty account receives some loyalty points.

With the Social Media API, you can:

  • Add a new channel to an account's followed channels.
  • List all social media channels of a member.

Before you begin

  • Install the Wix Loyalty Program app from the App Market.
  • Members can only follow enabled channels. A site owner has to enable channels in the dashboard.

Use cases

Terminology

  • Social Media: Online platforms and applications that enable users to create, share, and engage with content, as well as interact with others through communication, collaboration, and networking. For example, Facebook, Instagram, Twitter, and LinkedIn.
  • Loyalty Points: Type of reward system used by businesses to encourage customer engagement and retention. Customers earn points based on their purchases or specific actions, such as referrals or social media engagement. These points can typically be redeemed for discounts, free products, or exclusive benefits, fostering brand loyalty and repeat business.
Did this help?

Social Media: Sample Use Cases and Flows

This article shares some possible use cases your app could support, as well as a sample flow that could support each use case. This can be a helpful jumping off point as you plan your app's implementation.

Sync followed social media channels and loyalty points with an external system

If multiple Wix sites use your app with a loyalty program, you can synchronize followed social media channels and loyalty points across these sites. This synchronization ensures consistency, eliminates manual updates, and reduces the risk of data discrepancies.

To perform an initial upload and update all social media channels with associated loyalty points from a Wix site to your external system, follow these steps:

  • Initial setup
  • Synchronize to the external system

Part 1: Initial setup

  1. Create a custom field in your system. Add a field in your external system to store the followed social media record ID and loyalty points for each account ID. Ensure your code prevents this record ID from being overwritten by future updates.
  2. Create a mapping between the site's followed social media record and loyalty points fields and the corresponding fields in your external system. This mapping will be used whenever records are synchronized.
  3. Call List Followed Channels to retrieve all followed social media channels for the relevant account. Call Get Account to fetch account details, including loyalty points. Send the channels and points fields to the external system.

Part 2: Synchronize to the external system

  1. On an ongoing basis, monitor the following webhooks to detect updates to followed social media records and loyalty points:

  2. When the above webhooks are triggered, retrieve the record and loyalty points from the payload. Use the predefined mapping to update the external system with the new information.

Did this help?

Followed Channel Object


Properties
idstringRead-onlyformat GUID

Followed social media channel ID.


accountIdstringRead-onlyformat GUID

ID of the account that has followed a social media channel.


channelstring

Followed social media channel type.


createdDatestringRead-onlyformat date-time

Date when an entity for following a social media channel was created.

FollowedChannel
JSON
{ "id": "3efb39b6-5bae-493d-a8ed-749f3794a8ba", "accountId": "18de02d0-a88c-49f7-987f-8558ca02162d", "channel": "TIKTOK", "createdDate": "2024-08-01T11:51:41.431Z" }
Did this help?

GET

List Followed Channels


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Retrieves a list of social media channels followed by the account. The list is ordered by creation date.

Note: This method requires visitor or member authentication.

Permissions
Manage Loyalty
Read Loyalty
Learn more about app permissions.
Endpoint
GET
https://www.wixapis.com/loyalty-social-media/v1/followed-channels

Request
This endpoint does not take any parameters.
Response Object
followedChannelsArray <FollowedChannel>minItems 0maxItems 5

List of followed social media channels.

List followed social media channels
Request
cURL
curl -X POST \ 'https://www.wixapis.com/loyalty-social-media/v1/followed-channels' \ -H 'Authorization: <AUTH>' \
Response
JSON
{ "followedChannels": [ { "id": "3efb39b6-5bae-493d-a8ed-749f3794a8ba", "accountId": "18de02d0-a88c-49f7-987f-8558ca02162d", "channel": "X", "createdDate": "2024-08-01T11:51:41.431Z" }, { "id": "744f837a-b6ed-42aa-a7b6-87fcf4c77356", "accountId": "18de02d0-a88c-49f7-987f-8558ca02162d", "channel": "LINKEDIN", "createdDate": "2024-02-03T13:53:43.374Z" } ] }
Did this help?

POST

Create Followed Channel


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Creates an entity for the specified account ID when the account follows a social media channel.

Members can only follow enabled channels. A site owner has to enable channels in the dashboard.

Note: This method requires visitor or member authentication.

Permissions
Manage Loyalty
Learn more about app permissions.
Endpoint
POST
https://www.wixapis.com/loyalty-social-media/v1/followed-channels

Body Params
followedChannelFollowedChannelRequired

Followed social media channel details.

Response Object
followedChannelFollowedChannel

Followed social media channel details.

Create a record for the followed social media channel
Request
cURL
curl -X POST \ 'https://www.wixapis.com/loyalty-social-media/v1/followed-channels' \ -H 'Authorization: <AUTH>' \ -H 'Content-Type: application/json' \ -d '{ "followedChannel": { "channel": "X" } }'
Response
JSON
{ "followedChannel": { "id": "3efb39b6-5bae-493d-a8ed-749f3794a8ba", "accountId": "18de02d0-a88c-49f7-987f-8558ca02162d", "channel": "X", "createdDate": "2024-08-01T11:51:41.431Z" } }
Event TriggersThis method triggers the following events:
Did this help?

Followed Channel Created


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Triggered when an account follows a new channel.

Permissions
Manage Loyalty
Read Loyalty
Learn more about app permissions.
Event BodyEvent Body Event data is received as a JSON Web Token (JWT). It may be delayed. Be sure to verify the data was sent by Wix.
Event Data
idstring

Unique event ID. Allows clients to ignore duplicate webhooks.


entityFqdnstring

Fully qualified domain name of the entity associated with the event. Expected wix.loyalty.socialmedia.v1.followed_channel.


slugstring

Event name. Expected created.


entityIdstring

ID of the entity associated with the event.


eventTimestringformat date-time

Event timestamp.


triggeredByAnonymizeRequestboolean

Whether the event was triggered as a result of a privacy regulation application (for example, GDPR).


originatedFromstring

If present, indicates the action that triggered the event.


createdEventCreatedEvent

Event information.

Event Body

The data payload will include the following as an encoded JWT:

JSON
{ "data": { "eventType": "wix.loyalty.socialmedia.v1.followed_channel_created", "instanceId": "<app-instance-id>", "data": "<stringified-JSON>", // The identity field is sent as a stringified JSON "identity": { "identityType": "<identityType>", // ANONYMOUS_VISITOR, MEMBER, WIX_USER, APP "anonymousVisitorId": "<anonymousVisitorId>", // in case of ANONYMOUS_VISITOR "memberId": "<memberId>", // in case of MEMBER "wixUserId": "<wixUserId>", // in case of WIX_USER "appId": "<appId>" // in case of APP } } }

FollowedChannelCreated
JSON
{ "id": "9aca3895-8c58-48b7-84a5-35bcd431c125", "entityFqdn": "wix.loyalty.socialmedia.v1.followed_channel", "slug": "created", "entityId": "aaf51c30-a61c-473e-96be-a42dfa5064c0", "eventTime": "2024-08-12T08:12:17.813Z", "createdEvent": { "entity": { "id": "3efb39b6-5bae-493d-a8ed-749f3794a8ba", "accountId": "18de02d0-a88c-49f7-987f-8558ca02162d", "channel": "FACEBOOK", "createdDate": "2024-08-01T11:51:41.431Z" } } }
Did this help?