Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement web-hook to send mapped payload to external custom endpoints #304

Open
ck-c8y opened this issue Feb 10, 2025 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@ck-c8y
Copy link
Collaborator

ck-c8y commented Feb 10, 2025

This issues sketches the required changes to address a web-hook for to send mapped payload to external custom endpoints.
This was requested in #303.

We plan to create a new connector WebHook, e.g. dynamic.mapping.connector.http.WebHook and leave the existing Http Connector unchanged. The web-hook is only for outbound and has custom properties, whereas the already existing http Connector is a singleton and only has one property.

The custom properties of the web-hook could be:

  1. Base URL incl. host, port, context path, e.g. https://myServer.com:8001/webHook
  2. Different authorization mechanisms: basic, bearer token, ...
  3. content-type (some specialization of application/json)

Payload will be the mapped payload.

Possible properties in the web-hook could be specified in the code as follows:

        Map<String, ConnectorProperty> configProps = new HashMap<>();
	configProps.put("url",
			new ConnectorProperty(true, 0, ConnectorPropertyType.STRING_PROPERTY, false, false, null, null));
	configProps.put("user",
			new ConnectorProperty(false, 1, ConnectorPropertyType.STRING_PROPERTY, false, false, null, null));
	configProps.put("password",
			new ConnectorProperty(false, 2, ConnectorPropertyType.SENSITIVE_STRING_PROPERTY, false, false, null,
				null));
        String name = "Web Hook";
        String description = "Generic Web Hook to send custom payload in the body......\n" ;
        connectorType = ConnectorType.WEB_HOOK;
        connectorSpecification = new ConnectorSpecification(name, description, connectorType, configProps, false);

Tasks backend

  1. Implement dynamic.mapping.connector.http.WebHook
  2. Change method public boolean supportsOutbound() in dynamic.mapping.connector.core.client.AConnectorClient to public List<Direction> supportedDirections()
  3. Add WEB_HOOK to dynamic.mapping.connector.core.client.ConnectorType
  4. Registe web-hook in registerDefaultConnectors()
@ck-c8y ck-c8y added the enhancement New feature or request label Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant