August 12, 2024
The August 12, 2024 Karbon API release includes updates to filter by Contact Type, HMAC payload signing for Webhook Subscriptions and UK specific additions to Accounting Details
Filter Organizations and Contacts by ContactType
GET Contacts and GET Organizations
Endpoints:
- JSONCopied!
https://api.karbonhq.com/v3/Contacts
- JSONCopied!
https://api.karbonhq.com/v3/Organizations
When listing Contacts and Organizations it is now possible to filter results by Contact Type. The filter can be specified in two ways:
- as an exact match on ContactType, e.g. will match only the Contact TypeJSONCopied!
$filter=ContactType eq 'Prospect'
JSONCopied!Prospect
- as a partial match on ContactType, e.g. will match the Contact TypesJSONCopied!
$filter=contains(ContactType, 'Pro')
andJSONCopied!Prospect
JSONCopied!Service Provider
Refer to the Contacts API documentation or Organizations API documentation for a full example of the response from these endpoints.
Example use case
You want to automate the creation of check-in work items for VIP clients who have a Contact Type of
Client - VIP
You'll need:
- To ensure you have set up the Contact Type on your VIP clients as JSONCopied!
Client - VIP
- A work template for the check-in work
- An idea of when you want the work to start and be due by
Make a GET request to
https://api.karbonhq.com/v3/Organizations?$filter=ContactType eq 'Client - VIP'
https://api.karbonhq.com/v3/WorkItems
Webhook Security enhancements
POST WebhookSubscriptions
Endpoint:
https://api.karbonhq.com/v3/WebhookSubscriptions
⚠️ Target URLs must be secure
All newly created Webhook Subscriptions require a
TargetUrl
https://
Note: This requirement is case sensitive, i.e. URLs beginning with
HTTPS://
If the Target URL does not begin with
https://
400
JSONCopied!{
"error": {
"code": "4002",
"message": "Target URL must begin with https://"
}
}
Event timestamp in Webhook payload
A
Timestamp
This is useful to:
- determine whether the message is stale and can be discarded
- avoid susceptability to replay attacks in HMAC payload signing (see below)
An example of the new Webhook payload is:
JSONCopied!{ "ResourcePermaKey": "kCsVf7svWQw", "ResourceType": "Contact", "ActionType": "Updated", "Timestamp": "2024-08-01T21:54:36Z" }
HMAC Payload signing for Webhooks
It is now possible verify that Karbon was the sender of a webhook notification using a Hash-Based Message Authentication Codes (HMAC) payload signing. To do this, create a WebHook Subscription and include the optional property
SigningKey
SigningKey
A
Z
a
z
0
9
-
_
When a webhook payload is delivered to the subscribed Target URL a
Signature
SigningKey
Note: When validating the signature be sure to use the raw payload. Using a parsed or formatted version of the payload will return a different signature.
⚠️ The value assigned to
SigningKey
Example Request
Set the
SigningKey
example_1234-ABCD
POST
https://api.karbonhq.com/v3/WebhookSubscriptions
JSONCopied!{
"TargetUrl": "https://example.com/",
"WebhookType": "Contaact",
"SigningKey": "example_1234-ABCD"
}
Example Payload Signature
Using the
SigningKey
example_1234-ABCD
{"ResourcePermaKey":"kCsVf7svWQw","ResourceType":"Contact","ActionType":"Updated","Timestamp":"2024-08-01T21:54:36Z"}
Signature
8c42dd0e4779a2e8a56d3b8ef962238ca26f95ddc2d9abb0e76f04991a3442f3
Note: The
SigningKey
https://api.karbonhq.com/v3/WebhookSubscriptions
Additional reading:
Additions to Accounting Details
UK-Specific Enhancements to the Contacts API
The
/v3/Contacts
- JSONCopied!
GET /v3/Contacts
- JSONCopied!
POST /v3/Contacts
- JSONCopied!
PUT /v3/Contacts
New Entity Types for UK Contacts
When the country is set to "UK" in Accounting Details, additional entity types are now available in the EntityType field. These include:
- Charitable Incorporated Organisation (CIO)
- Company Limited by Guarantee (CLG)
- Community Interest Company (CIC)
- Limited Liability Partnership (LLP)
- Local Authority
- Non-Departmental Public Body
- Pension Scheme
- Royal Charter
- Unincorporated Association
If the
EntityType
Charitable Incorporated Organisation (CIO)
Company Limited by Guarantee (CLG)
Royal Charter
Charity Number
RegistrationNumber
Date of Signed Engagement
A new field, Date of Signed Engagement (
DateSignedEngagement
Example Use Case
These enhancements allow for more precise classification and compliance when managing UK-based contacts. The introduction of additional entity types ensures that all necessary legal and organisational details are recorded, particularly for charitable organisations.
Example Request
POST /v3/Contacts
JSONCopied!{
"FirstName": "William",
"LastName": "Connor",
"EntityDescription": {
"Text": "UK-based Community Interest Company"
},
"AccountingDetail": {
"CountryCode": "UK",
"EntityType": "Community Interest Company",
"DateOfSignedEngagement": "2024-08-01T00:00:00Z"
}
}
In this example, a new contact for a Community Interest Company (CIC) in the UK is being created, including the date of signed engagement.