-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathEventCallbackExample.cs
44 lines (38 loc) · 1.52 KB
/
EventCallbackExample.cs
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
using System.Collections.Generic;
using Newtonsoft.Json;
using Dropbox.Sign.Model;
using Dropbox.Sign;
namespace Dropbox.SignSandbox;
public class EventCallbackExample
{
public static void Run()
{
// use your API key
var apiKey = "324e3b0840f065eb51f3fd63231d0d33daa35d4ed10d27718839e81737065782";
// callbackData represents data we send to you
var callbackData = new Dictionary<string, object>()
{
["event"] = new Dictionary<string, object>()
{
["event_type"] = "account_confirmed",
["event_time"] = "1669926463",
["event_hash"] = "ff8b03439122f9160500c3fb855bdee5a9ccba5fff27d3b258745d8f3074832f",
["event_metadata"] = new Dictionary<string, object>()
{
["related_signature_id"] = null,
["reported_for_account_id"] = "6421d70b9bd45059fa207d03ab8d1b96515b472c",
["reported_for_app_id"] = null,
["event_message"] = null,
}
}
};
var callbackEvent = EventCallbackRequest.Init(JsonConvert.SerializeObject(callbackData));
// verify that a callback came from HelloSign.com
if (EventCallbackHelper.IsValid(apiKey, callbackEvent))
{
// one of "account_callback" or "api_app_callback"
var callbackType = EventCallbackHelper.GetCallbackType(callbackEvent);
// do your magic below!
}
}
}