If you’re familiar with webhooks it shouldn’t take long to integrate webhooks from Costlocker.

  1. Create webhooks
  2. Edit time entries via API or at costlocker.com
  3. Receive webhooks
  4. Delete webhooks

Today we notify you about about created and updated time entries.

0. Configuration

Prepare environment variables so curl example are little more readable.

CL_WEBHOOK="UUID_OF_EXISTING_WEBHOOK (create variable after first step)"

1. Create webhooks

Let’s prepare webhooks request. I recommend using https://requestbin.com/ for testing webhooks before you start writing production integration.

curl -X POST -u $CL_AUTH "$CL_API/webhooks" -d @webhooks-request.json



Costlocker returns uuid of created webhook. Save it in the environment variable CL_WEBHOOK.


2. Edit time entries

Trigger some changes in time entries. You could simply add/edit entries at costlocker.com, import time entries from Toggl etc. This article isn’t about creating time entries. So we expect that you somehow edit at least one entry :)

3. Receive webhooks

Immediately after editing entries you should see webhook event in requestbin.com:

requestbin.com example

Tip: use /webhooks/uuid/test endpoint for getting event structure without triggering any change.

curl -X GET -u $CL_AUTH "$CL_API/webhooks/$CL_WEBHOOK/test"

4. Delete webhooks

If you don’t need webhook anymore you can delete it.

curl -X DELETE -u $CL_AUTH "$CL_API/webhooks/$CL_WEBHOOK"

Slack notifications

Now you can push notifications to Slack. Add Slack webhook to url in 1st step. Check slack documentation if you’ve never worked with Slack webhooks.

Don’t forget to transform Costlocker events to Slack message. You can test it without a running server by copy-pasting payload from https://requestbin.com/. Or test your message in Message Builder.

Slack message preview

Did you find a mistake? Is something unclear or isn’t the code working? Help us to improve the article!