Skip to content

Commit

Permalink
Doc(Webhooks): add event notifications doc, including events list
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-crisanto committed Mar 12, 2024
1 parent 175753d commit 7beac4b
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Writerside/p.tree
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@
<toc-element topic="Java-SDK.md"/>
<toc-element topic="Docker-Support.md"/>
</toc-element>
<toc-element topic="Webhooks.md">
<toc-element topic="Webhook-events.md"/>
</toc-element>
<toc-element topic="Snippets.topic" hidden="true"/>
</instance-profile>
17 changes: 17 additions & 0 deletions Writerside/redirection-rules.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rules SYSTEM "https://resources.jetbrains.com/writerside/1.0/redirection-rules.dtd">
<rules>
<!-- format is as follows
<rule id="<unique id>">
<accepts>page.html</accepts>
</rule>
-->
<rule id="4e9a7da2">
<description>Created after removal of "Snippets" from ProWallet</description>
<accepts>Snippets.html</accepts>
</rule>
<rule id="3db36a5c">
<description>Created after removal of "Snippets" from ProWallet</description>
<accepts>Snippets.html</accepts>
</rule>
</rules>
2 changes: 1 addition & 1 deletion Writerside/topics/AboutProWallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ Effortlessly integrate %product_name% services into your projects with our SDK a
Our toolkit enhances the integration of %product_name% by offering a comprehensive suite of libraries specifically designed to be intuitive and user-friendly for developers.<a href="SDK-and-tools.md">See more</a>
</tab>
<tab title="Events notifications">
Stay seamlessly informed about updates on your transactions through our notification tools. Our WebHooks empowers you to effortlessly integrate and leverage real-time transaction updates, ensuring you are always in the know. <a href="Webhook-management.md">See more</a>
Stay seamlessly informed about updates on your transactions through our notification tools. Our WebHooks empowers you to effortlessly integrate and leverage real-time transaction updates, ensuring you are always in the know. <a href="Webhooks.md">See more</a>
</tab>
</tabs>
22 changes: 22 additions & 0 deletions Writerside/topics/Snippets.topic
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
SYSTEM "https://resources.jetbrains.com/writerside/1.0/xhtml-entities.dtd">
<topic xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/topic.v2.xsd"
title="Snippets" id="Snippets" is-library="true">

<snippet id="order_event_sample">
<code-block lang="json" collapsible="true">
{
"event": "orders.status",
"id" : "e1a3b4c5-6d7e-8f9a-0b1c-2d3e4f5a6b7c",
"payload": {
"order": {
"referenceId": "G1446845368",
"currentStatus": "CHARGE_PENDING"
}
}
}
</code-block>
</snippet>
</topic>
22 changes: 22 additions & 0 deletions Writerside/topics/Webhook-events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Webhook events

**%product_name%** sends webhooks to notify your system about the following events:

- [Order events](Webhook-events.md#order-events)

## Order events

<table>
<tr>
<td>Event</td>
<td>Trigger</td>
<td>Sample</td>
</tr>
<tr>
<td><code>order.created</code></td>
<td>When an order is created</td>
<td>
<include from="Snippets.topic" element-id="order_event_sample"/>
</td>
</tr>
</table>
40 changes: 40 additions & 0 deletions Writerside/topics/Webhooks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Webhooks

**%product_name%** supports webhooks, which allow you to receive real-time HTTP POST notifications when certain events occur in **%product_name%**. Webhooks are particularly useful for integrating **%product_name%** with your own systems, or for integrating with third-party services.

## How to use

To use webhooks, you need add a webhook subscription to your **%product_name%** account. You can do this by using [Webhook management](Webhook-management.md) endpoints.

> The webhooks will send the notification to the URL using the `POST` HTTP verb
>
{style="note"}

## Messages

Webhooks send messages to the URL you specify using the `POST` method. The messages are in JSON format and contain information about the event that triggered the webhook.

For example, when an order is paid by the customer, an event that let your system know that the order has been paid.

When your system receive the message, it must verify that the notification message:

- Comes from **%product_name%**
- Was not altered in transit
- Was intended for your organization
- Has a valid format

Then, the endpoint that attends the URL subscribed must respond with a `200 OK` status code to acknowledge the message.

### Format

The message format is as follows:

<include from="Snippets.topic" element-id="order_event_sample"/>

> The payload content may vary depending on the event that triggered the webhook.
>
{style="tip"}

## Security

For security, message are sent over HTTPS.

0 comments on commit 7beac4b

Please sign in to comment.