Skip to content

Commit 15eccb9

Browse files
committed
Webhooks section was missing.
1 parent 0de864c commit 15eccb9

3 files changed

Lines changed: 22 additions & 79 deletions

File tree

src/components/Navigation.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ export const navigation = [
191191
{ title: 'Quickstart', href: '/quickstart' },
192192
{ title: 'Authentication', href: '/authentication' },
193193
{ title: 'Errors', href: '/errors' },
194+
{ title: 'Webhooks', href: '/webhooks' }
194195
],
195196
},
196197
{

src/pages/index.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ export const sections = [
1414

1515
# API Documentation
1616

17-
Use the SentryPeer API to query Phone Numbers, IP Addresses, submit your own Honeypot Events, and more. {{ className: 'lead' }}
17+
Use the SentryPeer API to query Phone Numbers and IP Addresses collected from SentryPeer honeypots. You can even submit your own Honeypot Events, and more.
18+
Learn more [about SentryPeer](https://sentrypeer.com/about). {{ className: 'lead' }}
1819

1920
<div className="not-prose mb-16 mt-6 flex gap-3">
2021
<Button href="/quickstart" arrow="right" children="Quickstart" />

src/pages/webhooks.mdx

Lines changed: 19 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,27 @@ export const description =
33

44
# Webhooks
55

6-
In this guide, we will look at how to register and consume webhooks to integrate your app with SentryPeer. With webhooks, your app can know when something happens in SentryPeer, such as someone sending a message or adding a contact. {{ className: 'lead' }}
6+
In this guide, we will look at how to create and consume a webhook so that you can integrate your app with SentryPeer. With webhooks, your app can know when an API query finds a match on the [Phone Numbers](/phone-numbers) or [IP Addresses](/ip-addresses) resources. {{ className: 'lead' }}
77

8-
## Registering webhooks
8+
## Create a webhook
99

10-
To register a new webhook, you need to have a URL in your app that SentryPeer can call. You can configure a new webhook from the SentryPeer dashboard under [API settings](#). Give your webhook a name, pick the [events](#event-types) you want to listen for, and add your URL.
10+
To create a new webhook, you need to have a URL in your app that SentryPeer can *POST* to. You can configure a new webhook from the SentryPeer dashboard under [Integrations](https://sentrypeer.com/integrations). Give your webhook a name, set the payload subject and message, and add your URL.
1111

12-
Now, whenever something of interest happens in your app, a webhook is fired off by SentryPeer. In the next section, we'll look at how to consume webhooks.
12+
Now, whenever a RESTful API query finds a match (*200 OK*), a webhook is fired off by the SentryPeer platform. In the next section, we'll look at how to consume webhooks.
1313

1414
## Consuming webhooks
1515

16-
When your app receives a webhook request from SentryPeer, check the `type` attribute to see what event caused it. The first part of the event type will tell you the payload type, e.g., a conversation, message, etc.
16+
An incoming webhook request will contain a JSON payload with the following properties:
1717

1818
```json {{ title: 'Example webhook payload' }}
1919
{
20-
"id": "a056V7R7NmNRjl70",
21-
"type": "conversation.updated",
22-
"payload": {
23-
"id": "WAz8eIbvDR60rouK"
24-
// ...
25-
}
20+
"type": "sentrypeer_webhook",
21+
"subject": "Testing from SentryPeer",
22+
"number_or_ip_address": "Testing SentryPeer Webhook Integration",
23+
"message": "A match has been found!"
2624
}
2725
```
2826

29-
In the example above, a conversation was `updated`, and the payload type is a `conversation`.
30-
3127
<div className="not-prose">
3228
<Button
3329
href="#event-types"
@@ -41,88 +37,32 @@ In the example above, a conversation was `updated`, and the payload type is a `c
4137

4238
## Event types
4339

40+
At the moment, there is only one event type: `sentrypeer_webhook`. In the future, we will add more event types to the SentryPeer platform. Please [contact us](https://sentrypeer.com/contact) if you have any suggestions for new event types.
41+
4442
<Row>
4543
<Col>
4644

4745
<Properties>
48-
<Property name="contact.created">
49-
A new contact was created.
50-
</Property>
51-
<Property name="contact.updated">
52-
An existing contact was updated.
53-
</Property>
54-
<Property name="contact.deleted">
55-
A contact was successfully deleted.
56-
</Property>
57-
<Property name="conversation.created">
58-
A new conversation was created.
59-
</Property>
60-
<Property name="conversation.updated">
61-
An existing conversation was updated.
62-
</Property>
63-
<Property name="conversation.deleted">
64-
A conversation was successfully deleted.
65-
</Property>
66-
<Property name="message.created">
67-
A new message was created.
68-
</Property>
69-
<Property name="message.updated">
70-
An existing message was updated.
71-
</Property>
72-
<Property name="message.deleted">
73-
A message was successfully deleted.
74-
</Property>
75-
<Property name="group.created">
76-
A new group was created.
77-
</Property>
78-
<Property name="group.updated">
79-
An existing group was updated.
80-
</Property>
81-
<Property name="group.deleted">
82-
A group was successfully deleted.
83-
</Property>
84-
<Property name="attachment.created">
85-
A new attachment was created.
86-
</Property>
87-
<Property name="attachment.updated">
88-
An existing attachment was updated.
89-
</Property>
90-
<Property name="attachment.deleted">
91-
An attachment was successfully deleted.
46+
<Property name="sentrypeer_webhook">
47+
A standard SentryPeer webhook payload.
9248
</Property>
9349
</Properties>
94-
9550
</Col>
9651
<Col sticky>
9752

9853
```json {{ 'title': 'Example payload' }}
9954
{
100-
"id": "a056V7R7NmNRjl70",
101-
"type": "message.updated",
102-
"payload": {
103-
"id": "SIuAFUNKdSYHZF2w",
104-
"conversation_id": "xgQQXg3hrtjh7AvZ",
105-
"contact": {
106-
"id": "WAz8eIbvDR60rouK",
107-
"username": "KevinMcCallister",
108-
"phone_number": "1-800-759-3000",
109-
"avatar_url": "https://assets.protocol.chat/avatars/kevin.jpg",
110-
"last_active_at": 705103200,
111-
"created_at": 692233200
112-
},
113-
"message": "I’m traveling with my dad. He’s at a meeting. I hate meetings.",
114-
"reactions": [],
115-
"attachments": [],
116-
"read_at": 705103200,
117-
"created_at": 692233200,
118-
"updated_at": 692233200
119-
}
55+
"type": "sentrypeer_webhook",
56+
"subject": "Testing from SentryPeer",
57+
"number_or_ip_address": "Testing SentryPeer Webhook Integration",
58+
"message": "A match has been found!"
12059
}
12160
```
12261

12362
</Col>
12463
</Row>
12564

65+
{/*
12666
---
12767
12868
## Security
@@ -170,3 +110,4 @@ if (hash_equals($hash, $signature)) {
170110
</CodeGroup>
171111
172112
If your generated signature matches the `x-protocol-signature` header, you can be sure that the request was truly coming from SentryPeer. It's essential to keep your secret webhook key safe — otherwise, you can no longer be sure that a given webhook was sent by SentryPeer. Don't commit your secret webhook key to GitHub!
113+
*/}

0 commit comments

Comments
 (0)