App Push Notifications built with Webhooks

Easily implement Webhooks for Customized Notifications and Analytics

Italo Orihuela
Italo Orihuela
Oct 15, 2023

One of the main challenges of having an online community is being able to generate custom content and knowing the key analytics that are driving your community, hence staying updated with real-time information is crucial.

This tutorial will delve into the concept of Amity Social Cloud Webhooks, a powerful tool that allows applications to communicate and share data in real-time. We will explore how these Webhooks can be used to extend and build custom functionalities, such as creating personalized notifications and building your own analytics dashboard.

Furthermore, we will guide you through the process of setting up a Webhook system, ensuring you understand the importance of delivery headers. So, buckle up and get ready to dive into the world of Webhooks with Amity Social Cloud!


Before we begin, ensure you have the following:

  1. Basic understanding of APIs and HTTP requests.
  2. Familiarity with JSON format.
  3. A server to receive the Webhook events.
  4. An Amity Social Cloud Portal account
  5. An Amity Social Cloud Console Account

Note: If you haven’t already registered for an Amity account, we recommend following our comprehensive step-by-step guide in the Amity Portal to create your new network. Please consider that Webhook needs to be enabled by the Amity support team, so please get in contact with them for enabling it. This might take 5 business days.

Step 1: Understanding Webhooks

Webhooks, also known as “reverse APIs,” are a type of API driven by events rather than requests. Instead of one application making a request to another to receive a response, a Webhook allows one program to send data to another as soon as a particular event takes place. This real-time data sharing can be used to build custom functionalities like personalized notifications, analytics dashboards, message moderation systems, and more.

Step 2: Setting Up a Webhook System

To set up a Webhook system, you need to configure a URL endpoint that will receive the HTTP POST payload when an event is triggered. This can be done in the admin panel of your platform. Remember, all Webhooks will be triggered near-real-time as the events occur, and to preserve system performance, all webhook HTTP requests will timeout in 1.5 seconds. So, ensure your Webhook receiver provides a response back within this interval to prevent losing any requests.

Step 3: Understanding Delivery Headers

The HTTP POST payloads delivered to your Webhook’s configured URL endpoint will contain headers. One crucial header is the x-amity-signature, which is the HMAC Base64 digest of the response body. This digest is generated by performing a SHA-256 hash function with the secret key as the HMAC key and the JSON request body as the payload. Before processing the event, verify this header to prevent request forgery. Once you understand the previous details, you can start receiving the information through the Webhook system.

Example Delivery

To give you a better understanding, here’s an example of a delivery:

Creating Customized Notifications

Based on the example delivery, you can create a customized notification. For instance, when a new channel is created ("event": "channel.didCreate"), you can send a notification to the admin or relevant users. The notification could look something like this:

Using Webhooks for Analytics

The data received from the Webhook can also be used for analytics. For example, you can track the number of channels created over time, the users who are creating the most channels, or even the times of day when channel creation is most active. Here’s an example of how you might structure this data for analysis:

Final Thoughts

Amity Social Cloud provides Webhooks that offer a powerful way to extend the functionality of your applications, providing real-time data that can be used to create personalized notifications, analytics dashboards, and more. By understanding how to set up and manage Webhooks, you can harness their power to create more dynamic, responsive, and user-friendly applications. If you want to try this feature and explore having a customised social environment feel free to contact Amity!