logo
Webhooks are a mechanism that allows event information to be sent from one application to another, without the need for constant status checks. With webhooks, applications can exchange data in real time, enabling more efficient integration and process automation.
  • The events you have to choose from in the ONe application are:
  1. "Cart opened" is an event notifying that a user has opened a cart.
  1. β€œClient logged" is an event notifying that a user has logged into the platform. In case of inactivity for 30 minutes, renewed activity will resend this event.
  1. "OfferOpened BO" is an event notifying that a user has entered the offer view. The event is sent whenever the offer ID in the URL changes.
πŸ’‘
Webhooks can also be configured in BackOffice. Click here to see the manual.

Table of contents

Glossary

Name
Explanation
pageNumber
Page number to fetch
pageSize
Page size to fetch
search
Is used to search by webhook name. You must enter at least 3 characters
name
Name of webhook
status
ACTIVE, INACTIVE
webhookType name exchangeName
Type of webhook Possible to choose: CartOpened, ClientLogged, OfferOpened for CartOpened use p-u-o-m-e-c-cartopened-klient, for ClientLoggeduse p-u-o-m-e-c-clientlogged-klient, for OfferOpened use p-u-o-m-e-o-offeropened-klient
callbackUrl
The URL where the event will be sent
callbackAuthentication type username password
authorization data Authentication type. Possible to choose NONE, HTTP_BASIC username of authorization password of authorization
webhookId
Identifier of webhook

GET - returns list of existing webhooks

There is possible to get list of all existing webhooks. Use GET /api/v1/webhooks/integrations/auth-required/webhooks. The diagram below shows the dependence of communicating with the API:
Image without caption
Use the parameter in query below to get list of webhooks:
  • pageNumber
  • pageSize
Example request:
json
curl -X GET "https://api-preprod.one.unity.pl/api/v1/webhooks/integrations/auth-required/webhooks?pageNumber=1&pageSize=10" -H "accept: */*" -H "one-tenant: {tenant}" -H "ApiAuth: {apiKey}"
In response you will receive list of existing webhooks:
Example response:
json
{ "items": [ { "id": "c1d10add-f75d-4ac2-a930-58bc8ef9a316", "status": "ACTIVE", "name": "New sale", "webhookType": { "name": "CartOpened", "exchangeName": "p-u-o-m-e-c-cartopened-klient" }, "callbackUrl": "https://fgvw5dzdvrjlfqeq6gnwx73qwq0baind.lambda-url.eu-west-1.on.aws/", "callbackAuthentication": { "type": "HTTP_BASIC", "username": "admin", "password": "admin" } }, { "id": "ad4f29fa-674b-49a0-b872-86fb61b84c39", "status": "ACTIVE", "name": "Webhook test - karta", "webhookType": { "name": "CartOpened", "exchangeName": "p-u-o-m-e-c-cartopened-klient" }, "callbackUrl": "https://fgvw5dzdvrjlfqeq6gnwx73qwq0baind.lambda-url.eu-west-1.on.aws/", "callbackAuthentication": { "type": "HTTP_BASIC", "username": "admin", "password": "admin" } } ], "totalItems": 2, "pageNumber": 1, "totalPages": 1, "pageSize": 10, "nextPage": null }

POST - creates new webhook

In order to add new webhook to ONe platform use POST /api/v1/webhooks/integrations/auth-required/webhooks. The diagram below shows the dependency of communicating with the API:
Image without caption
Example request:
json
curl -X POST "https://api-preprod.one.unity.pl/api/v1/webhooks/integrations/auth-required/webhooks" -H "accept: */*" -H "one-tenant: {tenant}" -H "ApiAuth: {apiKey}" -H "Content-Type: application/json" -d " { "name": "New sale", -- required "status": "ACTIVE", -- required "webhookType": { -- required "name": "CartOpened", -- required "exchangeName": "p-u-o-m-e-c-cartopened-klient" -- required }, "callbackUrl": "https://fgvw5dzdvrjlfqeq6gnwx73qwq0baind.lambda-url.eu-west-1.on.aws/", -- required "callbackAuthentication": { -- required "type": "HTTP_BASIC", -- required "username": "admin", -- required when type = 'HTTP_BASIC', otherwise ignored "password": "admin" -- required when type = 'HTTP_BASIC', otherwise ignored } }
In response you will id of created webhook:
Example response:
json
{ "id": "c1d10add-f75d-4ac2-a930-58bc8ef9a316" }

PUT - updates existing webhook

With this endpoint it is possible to update existing webhook. To do this, use PUT/api/v1/webhooks/integrations/auth-required/webhooks. The sequence diagram below shows the process:
Image without caption
Example request:
json
curl -X PUT "https://api-preprod.one.unity.pl/api/v1/webhooks/integrations/auth-required/webhooks" -H "accept: */*" -H "one-tenant: {tenant}" -H "ApiAuth: {apiKey}" -d "{ { "id": "ad4f29fa-674b-49a0-b872-86fb61b84c39", -- required "status": "ACTIVE", -- required "name": "Webhook test - card", -- required "webhookType": { -- required "name": "CartOpened", -- required "exchangeName": "p-u-o-m-e-c-cartopened-klient" -- required }, "callbackUrl": "https://fgvw5dzdvrjlfqeq6gnwx73qwq0baind.lambda-url.eu-west-1.on.aws/", -- required "callbackAuthentication": { -- required "type": "HTTP_BASIC", -- required "username": "admin", -- required when type = 'HTTP_BASIC', otherwise ignored "password": "admin" -- required when type = 'HTTP_BASIC', otherwise ignored } }"

GET - returns details of webhook

There is possible to get details of webhook. Use GET/api/v1/webhooks/integrations/auth-required/webhooks/{webhookId} using specific ID (webhookId). The diagram below shows the dependence of communicating with the API:
Image without caption
Use the parameter in path below to get information about specific webhook:
  • webhookId
Example request:
json
curl -X GET "https://api-preprod.one.unity.pl/api/v1/webhooks/integrations/auth-required/webhooks/ad4f29fa-674b-49a0-b872-86fb61b84c39" -H "accept: */*" -H "one-tenant: {tenant}" -H "ApiAuth: {apiKey}"
In response you will receive information about specific webhook
Example response:
json
{ "id": "ad4f29fa-674b-49a0-b872-86fb61b84c39", "status": "ACTIVE", "name": "Webhook test - card", "webhookType": { "name": "CartOpened", "exchangeName": "p-u-o-m-e-c-cartopened-klient" }, "callbackUrl": "https://fgvw5dzdvrjlfqeq6gnwx73qwq0baind.lambda-url.eu-west-1.on.aws/", "callbackAuthentication": { "type": "HTTP_BASIC", "username": "admin", "password": "admin" } }

DELETE - deletes existing webhook

Use Delete /api/v1/webhooks/integrations/auth-required/webhooks/{webhookId} to delete existing webhook. The sequence diagram below shows the dependency of communicating with the API:
Image without caption
Use the parameter below in path to delete webhook:
  • webhookId
Example request:
json
curl -X DELETE DELETE "https://api-preprod.one.unity.pl/api/v1/webhooks/integrations/auth-required/webhooks/ad4f29fa-674b-49a0-b872-86fb61b84c39" -H "accept: */*" -H "one-tenant: {tenant}" -H "ApiAuth: {apiKey}"

POST - sends example request to webhook callback

In order to sends example request to webhook callback use POST /api/v1/webhooks/integrations/auth-required/webhooks/example. The diagram below shows the dependency of communicating with the API:
Image without caption
Example request:
json
curl -X POST "https://api-preprod.one.unity.pl/api/v1/webhooks/integrations/auth-required/webhooks/example" -H "accept: */*" -H "one-tenant: {tenant}" -H "ApiAuth: {apiKey}" -H "Content-Type: application/json" -d " { "webhookType": { -- required "name": "CartOpened", -- required "exchangeName": "p-u-o-m-e-c-cartopened-klient" -- required }, "callbackUrl": "https://fgvw5dzdvrjlfqeq6gnwx73qwq0baind.lambda-url.eu-west-1.on.aws/", -- required "callbackAuthentication": { -- required "type": "HTTP_BASIC", -- required "username": "admin", -- required when type = 'HTTP_BASIC', otherwise ignored "password": "admin" -- required when type = 'HTTP_BASIC', otherwise ignored } }
In response you will receive example request of webhook callback:
Example response:
json
{ "requestHeaders": { "Accept": [ "application/json, application/cbor, application/*+json" ], "Authorization": [ "Basic YWRtaW46YWRtaW4=" ], "one-tenant": [ "klient" ], "Content-Type": [ "application/json" ], "Content-Length": [ "267" ] }, "requestBody": "{\n \"type\" : \"CartOpened\",\n \"tenantKey\" : \"example\",\n \"cartId\" : \"00000000-0000-0000-0000-000000000000\",\n \"clientId\" : \"org:00000000-0000-0000-0000-000000000000\",\n \"eventId\" : \"13200948-cf44-4853-9eee-88eb9284ea23\",\n \"timestamp\" : \"2023-02-22T04:32:51.014160Z\"\n}" }

GET - returns list of valid webhook types

There is possible to get list of valid webhook types. Use GET/api/v1/webhooks/integrations/auth-required/webhooks/type using specific ID. The diagram below shows the dependence of communicating with the API:
Image without caption
Example request:
json
curl -X GET "https://api-preprod.one.unity.pl/api/v1/webhooks/integrations/auth-required/webhooks/types" -H "accept: */*" -H "one-tenant: {tenant}" -H "ApiAuth: {apiKey}"
In response you will receive information about valid webhook types
Example response:
json
[ { "name": "CartOpened", "exchangeName": "p-u-o-m-e-c-cartopened-klient" }, { "name": "ClientLogged", "exchangeName": "p-u-o-m-e-c-clientlogged-klient" }, { "name": "OfferOpened", "exchangeName": "p-u-o-m-e-o-offeropened-klient" } ]