-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathWebHookTest.cs
More file actions
59 lines (56 loc) · 2.25 KB
/
Copy pathWebHookTest.cs
File metadata and controls
59 lines (56 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using System.Net;
using Xunit;
namespace RingCentral.Tests;
[Collection("Sequential")]
public class WebHookTest
{
[Fact]
public async void SetupWebHook()
{
var rc = await ReusableRestClient.GetInstance();
try
{
await rc.Restapi().Subscription().Post(new CreateSubscriptionRequest
{
eventFilters = new[] { "/restapi/v1.0/account/~/extension/~/message-store" },
deliveryMode = new NotificationDeliveryModeRequest
{
transportType = "WebHook",
address = "http://www.example.com/webhook"
}
});
}
catch (RestException re)
{
// "errorCode":"SUB-523","message":"HTTPS is required"
// Or: webhook URI response is 404
Assert.Equal(HttpStatusCode.BadRequest, re.httpResponseMessage.StatusCode);
}
}
// [Fact]
// public async void VerificationToken()
// {
// using (var rc = new RestClient(
// Environment.GetEnvironmentVariable("RINGCENTRAL_CLIENT_ID"),
// Environment.GetEnvironmentVariable("RINGCENTRAL_CLIENT_SECRET"),
// Environment.GetEnvironmentVariable("RINGCENTRAL_SERVER_URL")
// ))
// {
// await rc.Authorize(
// Environment.GetEnvironmentVariable("RINGCENTRAL_JWT_TOKEN")
// );
// var subscriptionInfo = await rc.Restapi().Subscription().Post(new CreateSubscriptionRequest
// {
// eventFilters = new[] {"/restapi/v1.0/account/~/extension/~/presence?detailedTelephonyState=true"},
// deliveryMode = new NotificationDeliveryModeRequest
// {
// transportType = "WebHook",
// address = "https://75ef5993.ngrok.io/webhook",
// verificationToken = "hello-world"
// },
// expiresIn = 630720000
// });
// Assert.Equal(630720000, subscriptionInfo.expiresIn);
// }
// }
}