Author:
Fluent Commerce
Changed on:
13 Dec 2023
The Connect SDK offers seamless integration with webhooks, enabling you to receive messages and perform various actions based on incoming calls. This document provides an overview of the core features of the Connect SDK and outlines the steps to integrate it into your application.
Author:
Fluent Commerce
Changed on:
13 Dec 2023
The Connect SDK offers seamless integration with webhooks, enabling you to receive messages and perform various actions based on incoming calls. This document provides an overview of the core features of the Connect SDK and outlines the steps to integrate it into your application.
Connect SDK inherently provides an external webhook endpoint at `/api/v1/fluent-connect/external-system/webhook`
`localhost:8080/api/v1/fluent-connect/external-system/webhook`
`\/api/v1/fluent-connect/external-system/webhook`
By default, Connect SDK provides a list of default public endpoints and two custom authentication filters:
1 security:
2 web:
3 publicEndpoints:
4 - "/actuator/**"
5 - "/api/docs"
6 - "/swagger-ui.html"
7 - "/api/v1/fluent-connect/webhook"
8 - "/api/v1/fluent-connect/scheduler/**"
9 customAuthFilters:
10 - "com.fluentcommerce.connect.core.web.security.filters.ApiKeyAuthenticationFilter"
11 - "com.fluentcommerce.connect.core.web.security.filters.FluentOauthTokenAuthenticationFilter"
Language: java
Name: Security
Description:
[Warning: empty required content area]Author:
Fluent Commerce
Changed on:
13 Dec 2023
`connect-sdk-core-web-security`
`/api/v1/fluent-connect/external-system/webhook`
`8080`
Connect SDK inherently provides a webhook endpoint at `/api/v1/fluent-connect/external-system/webhook`
`http://localhost:8080/api/v1/fluent-connect/external-system/webhook`
`connect-sdk-core-web-security`
`route`
Webhook Request:
Header:
1Authorization: <insert authorization value>
2fluent.account: <insert associated fluent account value>
Language: java
Name: Header
Description:
[Warning: empty required content area]Body:
Below is the sample request body when calling the external webhook endpoint:
`route`
`payload`
`payload`
1{
2 "route" : "your-defined-handler-route",
3 "payload" : {
4 // props
5 }
6}
Language: json
Name: Body
Description:
[Warning: empty required content area]For example:
1{
2 "route" : "fc.connect.sample-weather-update",
3 "payload": {
4 "id":"demo-weather",
5 "code":"300",
6 "temperature":"40",
7 "description":"Hot Day"
8 }
9}
Language: json
Name: Request
Description:
[Warning: empty required content area]1@Component
2@HandlerInfo(name = "weather-update", route = "fc.connect.sample-weather-update")
3public class WeatherDataMessageHandler implements MessageHandler {
4 @Override
5 public void processMessage(@NotNull final MessageHandlerContext context) throws UnprocessableMessageException, HandlerRetryException {
6 UpsertSettingUtils.upsertSetting(getPayload(context), context, UpsertSettingUtils.FLUENT_SETTING_KEY);
7 }
8
9 protected WeatherData getPayload(final MessageHandlerContext context) {
10 // Extract data by defined Class `WeatherData`
11 final Optional<WeatherData> payload = context.getMessagePayload(WeatherData.class);
12 // Extract data by key-value
13 final Optional<Map> payload = context.getMessagePayload(Map.class);
14 // Handling optional data...
15 }
16}
Language: java
Name: Custom Handler Class:
Description:
[Warning: empty required content area]Copyright © 2024 Fluent Retail Pty Ltd (trading as Fluent Commerce). All rights reserved. No materials on this docs.fluentcommerce.com site may be used in any way and/or for any purpose without prior written authorisation from Fluent Commerce. Current customers and partners shall use these materials strictly in accordance with the terms and conditions of their written agreements with Fluent Commerce or its affiliates.