Skip to content

Commit

Permalink
Add custom event code snippets for JS and cURL
Browse files Browse the repository at this point in the history
  • Loading branch information
szuperaz committed May 15, 2024
1 parent f1d8cf2 commit 57773a1
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions docusaurus/video/docusaurus/docs/api/webhooks/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ Client-side you can observe calls and receive events by passing the `watch:true`

```js
// send a custom event to all users watching the call
TODO
call.sendCustomEvent({
custom: {
'render-animation': 'balloons',
},
user_id: 'john',
});
```

</TabItem>
Expand All @@ -33,13 +38,19 @@ call.send_call_event(user_id=user.id, custom={"render-animation": "balloons"})
<TabItem value="curl" label="cURL">

```bash
TODO
curl -X POST https://video.stream-io-api.com/api/v2/video/call/${CALL_TYPE}/${CALL_ID}/event?api_key=${API_KEY} \
-H "Authorization: ${TOKEN}" \
-H "stream-auth-type: jwt" \
-H 'Content-Type: application/json' \
-d '{
"custom": {"render-animation": "balloons"},
"user_id": "john"
}'
```

</TabItem>
</Tabs>


You can configure your Stream app to send events to your HTTP/webhook and/or to your AWS SQS queue. Webhooks are usually
the simplest way to receive events from your app and to perform additional action based on what happens to your application.

Expand All @@ -58,7 +69,7 @@ Your webhook handler can use the `type` field to handle events based correctly b
All webhook requests contain these headers:

| Name | Description |
|-------------------|----------------------------------------------------------------------------------------------------------------------|
| ----------------- | -------------------------------------------------------------------------------------------------------------------- |
| X-WEBHOOK-ID | Unique ID of the webhook call. This value is consistent between retries and could be used to deduplicate retry calls |
| X-WEBHOOK-ATTEMPT | Number of webhook request attempt starting from 1 |
| X-API-KEY | Your application’s API key. Should be used to validate request signature |
Expand All @@ -83,4 +94,3 @@ In case of the request failure Stream Chat attempts to retry a request. The amou
- Request timeout: 3 attempts

The timeout of one request is 6 seconds, and the request with all retries cannot exceed the duration of 15 seconds.

0 comments on commit 57773a1

Please sign in to comment.