Articles on: CMS

Webhook Events for Membership in details

Getting Started



This article will briefly cover the events and payloads called during a webhook event.

Event NameWhen will it be triggered?
add-memberWhen any new user subscribes to the free plan or when a new team member is added.
update-memberWhen an existing member updates their email or name.
remove-memberWhen a user is removed from the member list
add-subscriptionWhen a user purchases any paid plan
update-subscriptionWhen any paid member downgrades to a free plan or changes from annually to monthly or vice versa
cancel-subscriptionWhen a user cancels their subscription



Member Added



An add-member event is fired when new users subscribe to the free plan.

Information sent in the payload for an add-member webhook is summarised in the table below.

Payload



PropertyTypeDescriptionExample
nameStringThe name of the added member“John”
emailStringThe email address of the added memberabc@abc.com
userIdStringThe added member’s User ID644094d7f939e67758
eventNameStringName of the eventadd-member
eventIdStringThe unique ID of the eventadd-member-fj30fer
membershipObjectThis object will contain the value of the membership information (E.g customerId, subscriptionId)




membership object properties:

PropertyTypeDescriptionExample
customerIdStringThe customer ID of the member addedcus_43fdf43nkkdf
subscriptionIdStringThe Subscription ID of the membersubs_4e**** or null(if free member)
planIdStringThe Plan ID of a member added will be Freeor null(if free member)
statusStringStatus of the subscription
renewAtDateDate when the subscription is to be renewed
cancellationEffectiveDateDateDate when the cancellation will be effective


Member Updated



An update-member event is fired when an existing member updates their email or name.

Information sent in the payload for an update-member webhook is summarised in the table below.

Payload



PropertyTypeDescription
nameStringThe updated name of the existing member
emailStringThe updated email address of the existing member
userIdStringThe member’s User ID
eventNameStringName of the event
eventIdStringThe ID of the event
membershipObjectThis object will go to a payload containing the value of the membership


membership object properties:

PropertyTypeDescription
customerIdStringCustomer ID of the member
subscriptionIdStringSubscription ID of the member
planIdStringThe ID of the plan the user has subscribed to
statusStringStatus of the subscription
renewAtDateDate when the subscription is to be renewed
cancellationEffectiveDateDateDate when cancellation will be effective


Member Removed



A member-removed event is fired when a user is removed from the member list.

Information sent in the payload for a member-removed webhook is summarised in the table below.

Payload



PropertyTypeDescription
nameStringThe name of the removed member
emailStringThe email address of the removed member
userIdStringThe removed member’s User ID
eventNameStringName of the event
eventIdStringThe ID of the event
membershipObjectThis object will go into a payload containing the value of the membership


membership object properties:

PropertyTypeDescription
customerIdStringCustomer ID of the member
subscriptionIdStringSubscription ID of the member
planIdStringThe ID of the plan the user had subscribed to
statusStringStatus of the subscription
renewAtDateDate when the subscription is to be renewed
cancellationEffectiveDateDateDate when the cancellation will be effective


Subscriber Added



An add-subscription event is fired when a user purchases any paid plan

Information sent in the payload for an add-subscription webhook is summarised in the table below.

Payload



PropertyTypeDescription
nameStringThe name of the new subscriber
emailStringThe email address of the subscribed member
userIdStringThe new subscriber’s User ID
eventNameStringName of the event
eventIdStringThe ID of the event
membershipObjectThis object will go into a payload containing the value of the membership


membership object properties:

PropertyTypeDescription
customerIdStringCustomer ID of the new subscriber
subscriptionIdStringSubscription ID of the new subscriber
planIdStringThe ID of the plan the user had subscribed to
statusStringStatus of the subscription
renewAtDateDate when the subscription is to be renewed
cancellationEffectiveDateDateDate when the cancellation will be effective


Subscriber Updated



An update-subscription event is fired when any paid member updates to a free plan or changes from an annual to a monthly subscription or vice versa.

Information sent in the payload for an update-subscription webhook is summarised in the table below.

Payload



PropertyTypeDescription
nameStringThe name of the subscriber who updated their plan
emailStringThe email address of the subscriber
userIdStringThe new subscriber’s User ID
eventNameStringName of the event
eventIdStringThe ID of the event
membershipObjectThis object will go into a payload containing the value of the membership


membership object properties:

PropertyTypeDescription
customerIdStringCustomer ID of the subscriber
subscriptionIdStringSubscription ID of the subscriber
planIdStringThe ID of the plan the user had updated to
statusStringStatus of the subscription
renewAtDateDate when the subscription is to be renewed
cancellationEffectiveDateDateDate when the cancellation will be effective


Subscription Cancelled



An add-subscribtion event is fired when a user cancels their subscription.

Information sent in the payload for an add-subscribtion webhook is summarised in the table below.

Payload



PropertyTypeDescription
nameStringThe name of the subscriber who canceled their plan
emailStringThe email address of the subscriber
userIdStringThe subscriber’s User ID
eventNameStringName of the event
eventIdStringThe ID of the event
membershipObjectThis object will go into a payload containing the value of the membership


membership object properties:

PropertyTypeDescription
customerIdStringCustomer ID of the subscriber
subscriptionIdString
planIdStringIt will be updated to Free
statusStringStatus of the subscription
renewAtDate
cancellationEffectiveDateDate




Code Sample when a Member is Added



{
  "name": "Abcd Efgh",
  "email": "ilaxvdzrflpbhsrqoi@tmmwj.net",
  "user_id": "6391774374eb6d00132cd44e",
  "role": "subscriber",
  "membership": {
    "planId": "FREE",
    "status": "INACTIVE",
    "customerId": null
  },
  "eventName": "add-member",
  "eventId": "635e21996b8dfb00d3d231d7-PLFKEHEFZ-DCISC"
}


Code Sample when a Member is Updated



{
  "name": "Abcd Efgh",
  "email": "abcd@abcd.net",
  "user_id": "6391774374eb6d00132cd44e",
  "role": "subscriber",
  "membership": {
    "planId": "FREE",
    "status": "ACTIVE",
    "customerId": null
  },
  "eventName": "update-member",
  "eventId": "635e21996b8dfb00d3d231d7-PLFKEHEFZ-DCISC"
}


Code Sample when a Member is Removed



{
  "email": "sami97abrar@gmail.com",
  "user_id": "63956e801a11150011a0057f",
  "role": "subscriber",
  "membership": {
    "planId": "FREE",
    "status": "INACTIVE",
    "customerId": "cus_Mxdd6rr03JN9JC",
    "subscriptionId": null,
    "renewAt": null,
    "cancellationEffectiveDate": null
  },
  "eventName": "remove-member",
  "eventId": "62c69bb8215fc200b029d395-YKOQ-IAZYYZKMUE"
}


Code Sample when a Subscriber is Added



{
  "name": "Abcd Efgh",
  "email": "abcd@abcd.net",
  "user_id": "6391774374eb6d00132cd44e",
  "role": "subscriber",
  "membership": {
    "planId": "MONTHLY",
    "status": "ACTIVE",
    "customerId": null
  },
  "eventName": "add-subscription",
  "eventId": "635e21996b8dfb00d3d231d7-PLFKEHEFZ-DCISC"
}


Code Sample when a Subscription is Updated



{
  "name": "Abrar",
  "email": "sami97abrar@gmail.com",
  "role": "subscriber",
  "membership": {
    "customerId": "cus_MxeQ8wVzEJJbVY",
    "subscriptionId": "sub_1MDj8ERFal0kIVZ7DuIXcACG",
    "planId": "price_1Lm9FGRFal0kIVZ7Q9RzMP8E",
    "status": "ACTIVE",
    "renewAt": 1702276526000,
    "cancellationEffectiveDate": null,
  },
  "user_id": "63956f7c1a11150011a00584",
  "eventName": "update-subscription",
  "eventId": "62c69bb8215fc200b029d395-EUNLSJKW-LWWJQE"
}


Code Sample when a Subscription is Cancelled



{
  "name": "Abrar",
  "email": "sami97abrar@gmail.com",
  "role": "subscriber",
  "membership": {
    "customerId": "cus_MxeQ8wVzEJJbVY",
    "subscriptionId": "sub_1MDj8ERFal0kIVZ7DuIXcACG",
    "planId": "price_1Lm9FGRFal0kIVZ7Q9RzMP8E",
    "status": "CANCELLED",
    "renewAt": "2023-12-11T06:35:26.000Z",
    "cancellationEffectiveDate": 1702276526000,
  },
  "user_id": "63956f7c1a11150011a00584",
  "eventName": "cancel-subscription",
  "eventId": "62c69bb8215fc200b029d395-QBLNYSZF-KTXYAY"
}



Related articles



Adding Webhook for Membership Events

Updated on: 01/02/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!