Overview
Webhooks are a dynamic tool within Hapana’s platform, enabling real-time communication between our system and your external applications. By using webhooks, you can automate workflows, synchronize data, and ensure that your systems are instantly updated when key events occur inside of Hapana’s products. This guide provides an overview of how to subscribe to webhooks, what each webhook does, and examples of how they can be used.
What Are Webhooks?
Webhooks are HTTP callbacks that are triggered by specific events in the Hapana platform. When such an event occurs, a message (the webhook) is sent to a specified URL with data about that event.
To better understand how these webhooks can be utilized, let’s consider a few scenarios:
Scenario 1: Real-Time Client Updates
Your CRM is integrated with Hapana via the "clientUpdated" webhook. Whenever a client updates their contact information in Hapana, your CRM receives this update in real-time, ensuring that you always have the latest information.
Scenario 2: Automated Purchase Tracking
Using the "packagePurchased" webhook, your financial system receives instant updates whenever a client buys a new package. This automation eliminates manual data entry and reduces the risk of errors, ensuring your financial records are always up-to-date.
Scenario 3: Membership Status Notifications
The "clientStatusChange" webhook helps you manage membership renewals and suspensions. When a client’s membership status changes, your system can automatically send them a notification, prompting action if needed, such as renewing their membership.
How to Subscribe to Hapana Webhooks
To start receiving webhook notifications from Hapana, follow these steps:
1. Contact Hapana Support: Reach out to the Hapana Support team at [email protected] to initiate the subscription process.
2. Provide the Required Information:
-
Endpoint URL: This is the URL where you want Hapana to send the webhook data. Ensure that this endpoint is secure and capable of handling the data payloads.
-
Webhook Subscription List: Specify which webhook events you want to subscribe to. You can choose one or multiple webhooks based on your needs from the webhook events listed below.
-
Optional Authentication Header: To secure your webhook endpoint, you can provide a Header Key name and a Header Key value. These will be included in the HTTP headers of every webhook request to authenticate the source.
Available Webhooks
Here's a detailed breakdown of each available webhook, including what activates it, the data it transmits, and how you can leverage it.
1. Communication Outbound Webhook:
-
Trigger Event: This webhook is triggered whenever a client purchases a package or membership across your corporate setup.
-
Event Type: "outboundMessage"
-
Payload Details:
-
clientID: Unique identifier for the client.
-
siteID: Identifier for the site where the purchase occurred.
-
email: Client’s email address.
-
messageId: Unique ID for the message sent
-
communicationType: Specifies if the message is an SMS or Email.
-
message: Content of the communication. This is plain text for SMS and HTML code for emails.
-
phone (for SMS): Phone number for SMS messages.
-
emailTo, emailFrom, subject (for Email): Details specific to email communication.
-
-
Usage example:
-
Automatically sending a confirmation message to a client’s phone or email after they purchase a membership.
-
Updating your CRM system with communication records for client interactions.
-
2. Account Created Webhook
-
Trigger Event: Fired when a new account is created or linked to a new location within your corporate structure.
-
Event Type: "accountCreated"
-
Payload Details:
-
Personal Information: Includes "client ID", "first Name", "last Name", "email", and "phone".
-
Emergency Contacts: Information such as Name, Email and Phone number.
-
Additional Data: Includes "barcode ID", "address", "birthdate", "join date", "lead source", and "custom properties".
-
-
Usage example:
-
Onboarding new clients into your CRM or other customer management tools.
-
Sending a welcome email with all necessary account details.
-
3. Client Updated Webhook
-
Trigger Event: This webhook is activated whenever there’s a change in a client’s primary information.
-
Event Type: "clientUpdated"
-
Payload Details:
-
Updated Information: Includes "first name", "last name", "email", "phone", and other key data that has been changed.
-
-
Usage example:
-
Ensuring that updates to client information in Hapana are reflected across all integrated systems.
-
Triggering notifications or follow-up actions when a client’s contact information is changed.
-
4. Client Status Change Webhook
-
Trigger Event: Fired when a client’s status changes to one of the predefined states: "intro Offer", "active Package", "suspended Membership", or "inactive".
-
Event Type: "clientStatusChange"
-
Payload Details:
-
Status Details: Includes the client’s new status and a list of active packages.
-
Package Information: Details on the packages tied to the client, including "packageID" and "packageName".
-
-
Usage example:
-
Automatically updating a client’s status in your system to reflect changes such as membership renewal, suspension, or expiration.
-
Triggering automated communications to clients when their status changes, such as reminding them to renew an expiring membership.
-
5. Package Purchase Webhook
-
Trigger Event: Triggered when a client purchases a package or membership.
-
Event Type: "packagePurchased"
-
Payload Details:
-
Purchase Details: Includes "package Name", "package Type" (e.g., "membership", "session package"), "package Category", "package ID", and the purchase "amount".
-
Client Information: Basic client details such as "name", and "email".
-
-
Usage example:
-
Integrating with financial systems to record purchases in real-time.
-
Triggering inventory adjustments based on package sales or automatically sending receipts.
-
6. Client Check-In Webhook
-
Trigger Event: Fired when a client checks in for a general visit or a specific class session.
-
Event Type: "checkIn"
-
Payload Details:
-
Check-In Details: Includes "check in time", "client ID", "first name", "last name", "session ID", and session-related information.
-
Validation Status: Indicates whether the check-in is valid or invalid, along with any relevant messages (e.g., “valid check-in with alerts,” “invalid check-in – no valid membership”).
-
Custom Properties: Additional custom fields relevant to the check-in, tailored to your setup.
-
-
Usage example:
-
Automatically logging client attendance for classes and general visits.
-
Ensuring that clients only access services they are eligible for, based on their membership or package status.
-
Requesting Webhook Subscriptions
When you're ready to set up your webhook subscriptions, here's an example of how to make the request:
"Subject: Request for Webhook Subscription
Message:
Hi Hapana Support Team,
I would like to subscribe to the following webhooks:
1. Webhook Type: "clientStatusChange"
-
Endpoint URL: https://yourdomain.com/webhooks/status-change
-
Authentication Header:
-
Header Key Name: "Authorization"
-
Header Key Value: "Bearer your-auth-token"
2. Webhook Type: "packagePurchased"
-
Endpoint URL: https://yourdomain.com/webhooks/package-purchase"
After your message is sent, the support team will contact you with the status of your request. Please ensure that the endpoint URLs are correctly configured to receive and process these webhooks securely.
By effectively utilizing Hapana’s webhooks, you can automate a wide range of processes, reduce manual effort, and maintain up-to-date data across all your systems. If you have any further questions or need assistance with setting up webhooks, the Hapana Support team is here to help.