This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
api-webhooks [2017/01/18 14:25] ben [Confirm the Request is Genuine] |
api-webhooks [2017/01/18 14:29] ben |
||
---|---|---|---|
Line 191: | Line 191: | ||
</code> | </code> | ||
- | ===== Mailig List Unsubscribe Webhook ===== | + | |
+ | ==== Confirm the Request is Genuine ==== | ||
+ | To confirm the request isn't from another system impersonating Sentori, perform the following operation. | ||
+ | |||
+ | - Concatenate the //AccountExternalID//, //EmailAddress//, //MailingListExternalID//, //Type//, //Date// values from the request (so exclude //Description// and //vhash//) and your //API Key// | ||
+ | - Convert the result into bytes | ||
+ | - Get the SHA1 hash of those bytes and remove any hyphen characters | ||
+ | |||
+ | If the result matches the //vhash// value in the request, it's genuine. | ||
+ | |||
+ | \\ | ||
+ | \\ | ||
+ | |||
+ | Here's the example above being checked using C# code: | ||
+ | |||
+ | The API Key of this Sentori Account is "20011111-1111-1111-1111-111111111200". | ||
+ | |||
+ | <code> | ||
+ | string values = "1234ABCD" + "user@example.com" + "ABCD1234" + "subscribe" + "2016-10-28T14:59:43.6889402Z" + "20011111-1111-1111-1111-111111111200"; | ||
+ | byte[] bytes = System.Text.Encoding.Default.GetBytes(values); | ||
+ | System.Security.Cryptography.SHA1Managed sha1 = new System.Security.Cryptography.SHA1Managed(); | ||
+ | string checkHash = BitConverter.ToString(sha1.ComputeHash(bytes)); | ||
+ | checkHash = checkHash.Replace("-", string.Empty); | ||
+ | // Output is "true" if genuine, "false" if not. | ||
+ | Console.WriteLine("Is genuine? " + ("0321B442144F3EF8663EF47D738E2EDEDEBDF73F" == checkHash)); | ||
+ | </code> | ||
+ | |||
+ | \\ | ||
+ | \\ | ||
+ | |||
+ | |||
+ | ===== Mailing List Unsubscribe Webhook ===== | ||
Sentori calls this Webhook when a Contact is removed from a Mailing List, whether by a Contact performing an action (including Unsubscribing from the Account) or a User through Sentori's interface. | Sentori calls this Webhook when a Contact is removed from a Mailing List, whether by a Contact performing an action (including Unsubscribing from the Account) or a User through Sentori's interface. | ||
Line 262: | Line 293: | ||
\\ | \\ | ||
- | |||
- | ==== Confirm the Request is Genuine ==== | ||
- | To confirm the request isn't from another system impersonating Sentori, perform the following operation. | ||
- | |||
- | - Concatenate the //AccountExternalID//, //EmailAddress//, //MailingListExternalID//, //Type//, //Date// values from the request (so exclude //Description// and //vhash//) and your //API Key// | ||
- | - Convert the result into bytes | ||
- | - Get the SHA1 hash of those bytes and remove any hyphen characters | ||
- | |||
- | If the result matches the //vhash// value in the request, it's genuine. | ||
- | |||
- | \\ | ||
- | \\ | ||
- | |||
- | Here's the example above being checked using C# code: | ||
- | |||
- | The API Key of this Sentori Account is "20011111-1111-1111-1111-111111111200". | ||
- | |||
- | <code> | ||
- | string values = "1234ABCD" + "user@example.com" + "ABCD1234" + "subscribe" + "2016-10-28T14:59:43.6889402Z" + "20011111-1111-1111-1111-111111111200"; | ||
- | byte[] bytes = System.Text.Encoding.Default.GetBytes(values); | ||
- | System.Security.Cryptography.SHA1Managed sha1 = new System.Security.Cryptography.SHA1Managed(); | ||
- | string checkHash = BitConverter.ToString(sha1.ComputeHash(bytes)); | ||
- | checkHash = checkHash.Replace("-", string.Empty); | ||
- | // Output is "true" if genuine, "false" if not. | ||
- | Console.WriteLine("Is genuine? " + ("0321B442144F3EF8663EF47D738E2EDEDEBDF73F" == checkHash)); | ||
- | </code> | ||
- | |||
- | \\ | ||
- | \\ | ||
===== Email Bounce Webhook ===== | ===== Email Bounce Webhook ===== |