top of page

What Are Webhooks and How to Use Them

Updated: Mar 10

As a business, you need to know what sort of actions are being taken on your website. Are they taken by casual visitors or loyal customers? In order to have a clear picture, you’ll need to know the answer to the following question: what are webhooks?


There is so much information to be gained if you can be notified whenever your customers take important actions on your platform.


It sets you up for success, especially when you can send out perfectly-timed emails to your customers to address a concern they have, or just to welcome them to your platform. If your question is “how?”, then you’ve come to the right place.


Enter: Webhooks

Here’s what you need to know about webhooks and how they work, in addition to learning how to use them as an online business.

Let’s dive right in.


What Are Webhooks?

In short, webhooks are the mechanism that allows different apps or platforms to communicate with each other by sending them messages (or hooks, basically).


They’re a straightforward way for your online accounts to notify each other if there is a specific event is triggered.


For instance, you might have a finance app on your phone tracking your income and expenses. When you get paid on PayPal, your finance app gets to send you a notification that you’ve received a payment.


Your finance app was able to accomplish this step via webhooks to your PayPal account.

This all sounds great if you’re the end-user. However, when you’re the online business, the end-user (in most cases) is your customer. How do webhooks benefit you in this case?


The Business’ Webhooks

Consider it this way: you’d probably like to know whenever a customer becomes a paying subscriber.

The first step would be having a platform that recognizes your customer’s action (in this case, signing up to your subscription) as an event.

Once this event occurs, you’ll want to have a system in place that pings that event as active, and send you a notification telling you all about it, with as much detail as possible.

Afterward, you’d like to have a protocol in place to greet your new subscriber, like a welcome email or an SMS.

With Pelcro, you can streamline this whole process, webhooks and all.


Webhooks in Action

Pelcro makes setting up webhooks quite simple. You can easily head to the settings, click on ‘Notifications,’ and it’ll take you where you need to insert your webhook endpoint.

Pelcro’s account notifications page, with the webhook endpoint field.

You’ll need to have a place to receive these notifications —these hooks if you will— and they’re known as a webhook endpoint or receiver. You can picture it as a mailbox ready to receive your mail.


Once you create your webhook, a notification will be sent your way, whenever a specific event occurs on your website.


Moreover, this notification more than a simple heads-up. This type of notification is called a payload. It’s a set of data describing the event (the action your customer took) in detail.


A Study in Webhooks

In order to have a full understanding of how webhooks work on the ground level for businesses, a thorough example is in order.


Let’s create a hypothetical online magazine called Cornucopia, and see how webhooks works for its business model.


Cornucopia needs to keep track of their potential and existing customers’ actions on its website, which brings them to the urgent need for solid webhooks.


The first thing a new customer goes on Cornucopia’s website is creating a new account, which brings us to our first event.


Event 1: Customer Created an Account

Once a new customer creates an account on Cornucopia’s platform, the established webhook endpoint receives a payload from Pelcro’s webhooks. The webhook triggered in response to this event, in this case, is the “customer.password_reset.”

This webhook will send a payload to the webhook endpoint Cornucopia has added to their notification settings.


The “customer.password_reset” payload will include the following data values in a JSON format.

type
customer.PasswordResetRequestSubmitted
id
evt_uvaCZ5hxlkHAEuBYFazRg6wu
created
1581094531
data__object__object
customer
data__object__id
83
data__object__balance
0
data__object__created
2020-02-07 16:55:29
data__object__currency
data__object__default_source
data__object__delinquent
False
data__object__email
reem+simpson@pelcro.com
data__object__first_name
John
data__object__has_password
False
data__object__last_name
M. Simpson
data__object__metadata__pelcro_account_id
1
data__object__metadata__pelcro_customer_id
83
data__object__phone
data__object__password_reset_token
a0c64dd6bb8258d2c87091b170fe35203b8ce749b0b0c3eca0ff0be3e962822c 

Insert here

As you can see, this payload tells Cornucopia everything from the customer’s name to their email, as well as their ID number.

Once it receives this payload, Cornucopia gets to decide what it would like to do with the data. It extracts the data from the payload, then injects it into a template with an Email Service Provider (ESP) integration. The end result is an email sent out to their customer.

Reset Password email is triggered via webhooks sent from Pelcro to Cornucopia’s receiver.

Event 2: Customer Created a New Subscription

Another common event that is essential to businesses is knowing when a customer signs up for a paid subscription plan.


Without active webhooks, there is no way Cornucopia can keep track of when its customers transition from casual visitors to paying customers.


This makes webhooks invaluable to maintaining a healthy subscription service, where businesses know which customers to engage as well as the timing and format of engagement material.


In this case, the triggered event is a customer signing up for a subscription plan on Cornucopia’s platform. The webhook responsible for this event is “subscription.created.”

As with the previous event, this webhook will send a payload to the webhook endpoint Cornucopia has added to their notification settings as well.


The “subscription.created” payload will include the following data values in JSON format. This is a small excerpt from the payload.

{
  "type": "subscription.created",
  "id": "evt_eV1T6HcNS0qnfzMrQXP09CR1",
  "created": 1581110231,
  "data": {
    "object": {
      "object": "subscription",
      "id": 54,
      "address_id": null,
      "agency_id": null,
      "backdate_start_date": null,
      "billing": "charge_automatically",
      "billing_cycle_anchor": "2020-02-07 21:17:08",
      "cancel_at": null,
      "cancel_at_period_end": 0,
      "cancel_reason": null,
      "canceled_at": null,
      "coupon": null,
      "created": "2020-02-07 21:17:08",
      "current_period_end": "2021-02-07 21:17:08",
      "current_period_start": "2020-02-07 21:17:08",
      "customer": {
        "object": "customer",
        "id": 83,
        "balance": 0,
        "created": "2020-02-07 16:55:29",
        "currency": "cad",
        "default_source": {
          "object": "source",
          "id": 29,
          "address_line1_check": "pass",
          "address_zip_check": "pass",
          "brand": "Visa",
          "country": "US",
          "cvc_check": "pass",
          "dynamic_last4": null,
          "exp_month": 12,
          "exp_year": 2022,
          "fingerprint": "Ckhj6PPVhovMUmmB",
          "funding": "credit",
          "last4": "4242",
          "name": null,
          "three_d_secure": "optional",
          "tokenization_method": null 

This payload presents numerous data points about the customer to Cornucopia.

The data includes payment method details, whether the customer set the subscription to auto-renew or not, as well as the subscription duration.


Furthermore, Cornucopia has chosen to extract the information from this payload to insert in an email template welcoming new subscribers to its platform.

Cornucopia’s welcome email to new subscribers.

Pelcro’s Offerings

In the previous section, we went through examples of two webhooks. However, Pelcro has way more than two webhooks in store. We have a total of 14 webhooks available and ready to send payloads to publishers.


Here’s the list of Pelcro’s webhooks, divided according to their event types.

Customer-Based Events

  1. customer.created: Occurs whenever a customer creates an account

  2. customer.password_reset: Occurs when a customer requests a password reset

  3. customer.updated: Occurs whenever a customer updates their account

Address-Based Events

  1. address.created: Occurs whenever a customer creates an address

  2. address.updated: Occurs whenever a customer updates his address

Subscription-Based Events

  1. subscription.created: Occurs whenever a customer subscribes to a plan

  2. subscription.updated: Occurs whenever a customer updates their subscription.

  3. subscription.canceled: Occurs whenever a customer cancels a subscription.

Invoices-Based Events

  1. invoice.created: Occurs whenever an invoice is created

  2. invoice.updated: Occurs whenever an invoice is updated

Newsletter-Based Events

  1. newsletter.created: Occurs whenever a newsletter is created

  2. newsletter.updated: Occurs whenever a newsletter is updated

Payment Methods-Based Events

  1. source.created: Occurs whenever a customer adds a credit or debit card

  2. source.updated: Occur whenever a customer updates a credit or debit card

Webhooks for the Win

Getting your webhooks in a row can be a bit of a pain.

However, once they’re all set, it’s easy to maintain a consistent eye on what your readers are up to, as well as making sure that you’re taking the right follow-up actions to crank up your engagement levels.

If you’re trying to figure out on your own, you don’t have to continue doing so. In addition, things can be a bit tricky if you’re trying to migrate from one platform to another. Thus, you can schedule a demo with our team, and they’ll be ready to show you the value that Pelcro can add to your publication.

We come armed with webhooks and a multitude of other tools to transform your platform.

bottom of page