Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 154 additions & 0 deletions docs/content/docs/reference/components/amplitude.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
---
title: "Amplitude"
description: "Build better products by turning your user data into meaningful insights, using Amplitude's digital analytics platform and experimentation tools."
---


Categories: Analytics


Type: amplitude/v1

<hr />



## Connections

Version: 1


### custom

#### Properties

| Name | Label | Type | Description | Required |
|:---------------:|:--------------:|:------------:|:-------------------:|:--------:|
| api_key | API Key | STRING | The API key for the Amplitude project | true |
| region | Region | STRING <details> <summary> Options </summary> api2, api.eu </details> | Environment region you wish to access the API in. | true |





<hr />


## Actions


### Create Attribution Event
Name: createAttributionEvent

`Creates attribution event using Attribution API.`

#### Properties

| Name | Label | Type | Description | Required |
|:---------------:|:--------------:|:------------:|:-------------------:|:--------:|
| event_type | Event Type | STRING | The event info. Prefix with brackets [YOUR COMPANY]. | true |
| platform | Platform | STRING <details> <summary> Options </summary> ios, android </details> | Platform which the event will occur on. | true |
| identifier | Identifier | OBJECT <details> <summary> Properties </summary> &#123;STRING\(key), STRING\(value)&#125; </details> | Identifier of the platform. | true |
| user_properties | User Properties | ARRAY <details> <summary> Items </summary> [&#123;STRING\(key), STRING\(value)&#125;\($property)] </details> | A dictionary of attribution properties prefixed with brackets [YOUR COMPANY]. | false |

#### Example JSON Structure
```json
{
"label" : "Create Attribution Event",
"name" : "createAttributionEvent",
"parameters" : {
"event_type" : "",
"platform" : "",
"identifier" : {
"key" : "",
"value" : ""
},
"user_properties" : [ {
"key" : "",
"value" : ""
} ]
},
"type" : "amplitude/v1/createAttributionEvent"
}
```

#### Output



Type: STRING








### Create or Update User
Name: createOrUpdateUser

`Creates or updates user without sending an event.`

#### Properties

| Name | Label | Type | Description | Required |
|:---------------:|:--------------:|:------------:|:-------------------:|:--------:|
| id | ID | STRING <details> <summary> Options </summary> user_id, device_id </details> | Choose to create or update a user or a device. | true |
| device_id | Device ID | STRING | A device specific identifier, such as the Identifier for Vendor (IDFV) on iOS. | true |
| user_id | User ID | STRING | Unique user ID specified by you. If you send a request with a user ID that's not in the Amplitude system, new user will be created (e.g. email address). | true |
| user_properties | User Properties | ARRAY <details> <summary> Items </summary> [&#123;STRING\(key), STRING\(value)&#125;\($property)] </details> | A dictionary of attribution properties prefixed with brackets [YOUR COMPANY]. | false |
| platform | Platform | STRING | The platform that's sending the data. | false |
| os_name | Operating System Name | STRING | The mobile operating system or browser the user is on. | false |
| device_brand | Device Brand | STRING | The device brand the user is on. | false |
| carrier | Carrier | STRING | The carrier of the device the user is on. | false |
| country | Country | STRING | The country the user is in. | false |
| city | City | STRING | The city the user is in. | false |
| dma | Designated Market Area | STRING | The Designated Market Area of the user. | false |
| language | Language | STRING | The language the user has set. | false |

#### Example JSON Structure
```json
{
"label" : "Create or Update User",
"name" : "createOrUpdateUser",
"parameters" : {
"id" : "",
"device_id" : "",
"user_id" : "",
"user_properties" : [ {
"key" : "",
"value" : ""
} ],
"platform" : "",
"os_name" : "",
"device_brand" : "",
"carrier" : "",
"country" : "",
"city" : "",
"dma" : "",
"language" : ""
},
"type" : "amplitude/v1/createOrUpdateUser"
}
```

#### Output



Type: STRING










<hr />

# Additional instructions

1 change: 1 addition & 0 deletions server/apps/server-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ dependencies {
implementation(project(":server:libs:modules:components:ai:vectorstore:weaviate"))
implementation(project(":server:libs:modules:components:airtable"))
implementation(project(":server:libs:modules:components:aitable"))
implementation(project(":server:libs:modules:components:amplitude"))
implementation(project(":server:libs:modules:components:apify"))
implementation(project(":server:libs:modules:components:apollo"))
implementation(project(":server:libs:modules:components:app-event"))
Expand Down
1 change: 1 addition & 0 deletions server/ee/apps/worker-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ dependencies {
implementation(project(":server:libs:modules:components:ai:vectorstore:weaviate"))
implementation(project(":server:libs:modules:components:airtable"))
implementation(project(":server:libs:modules:components:aitable"))
implementation(project(":server:libs:modules:components:amplitude"))
implementation(project(":server:libs:modules:components:apify"))
implementation(project(":server:libs:modules:components:apollo"))
implementation(project(":server:libs:modules:components:app-event"))
Expand Down
2 changes: 2 additions & 0 deletions server/libs/modules/components/amplitude/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
version="1.0"

Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright 2025 ByteChef
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.bytechef.component.amplitude;

import static com.bytechef.component.definition.ComponentDsl.component;
import static com.bytechef.component.definition.ComponentDsl.tool;

import com.bytechef.component.ComponentHandler;
import com.bytechef.component.amplitude.action.AmplitudeCreateAttributionEventAction;
import com.bytechef.component.amplitude.action.AmplitudeCreateOrUpdateUserAction;
import com.bytechef.component.amplitude.connection.AmplitudeConnection;
import com.bytechef.component.definition.ComponentCategory;
import com.bytechef.component.definition.ComponentDefinition;
import com.google.auto.service.AutoService;

/**
* @author Nikolina Spehar
*/
@AutoService(ComponentHandler.class)
public class AmplitudeComponentHandler implements ComponentHandler {

private static final ComponentDefinition COMPONENT_DEFINITION = component("amplitude")
.title("Amplitude")
.description(
"Build better products by turning your user data into meaningful insights, using Amplitude's digital " +
"analytics platform and experimentation tools.")
.icon("path:assets/amplitude.svg")
.categories(ComponentCategory.ANALYTICS)
.connection(AmplitudeConnection.CONNECTION_DEFINITION)
.actions(
AmplitudeCreateAttributionEventAction.ACTION_DEFINITION,
AmplitudeCreateOrUpdateUserAction.ACTION_DEFINITION)
.clusterElements(
tool(AmplitudeCreateAttributionEventAction.ACTION_DEFINITION),
tool(AmplitudeCreateOrUpdateUserAction.ACTION_DEFINITION));

@Override
public ComponentDefinition getDefinition() {
return COMPONENT_DEFINITION;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*
* Copyright 2025 ByteChef
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.bytechef.component.amplitude.action;

import static com.bytechef.component.amplitude.constant.AmplitudeConstants.API_KEY;
import static com.bytechef.component.amplitude.constant.AmplitudeConstants.EVENT;
import static com.bytechef.component.amplitude.constant.AmplitudeConstants.EVENT_TYPE;
import static com.bytechef.component.amplitude.constant.AmplitudeConstants.IDENTIFIER;
import static com.bytechef.component.amplitude.constant.AmplitudeConstants.KEY;
import static com.bytechef.component.amplitude.constant.AmplitudeConstants.PLATFORM;
import static com.bytechef.component.amplitude.constant.AmplitudeConstants.USER_PROPERTIES_OBJECT;
import static com.bytechef.component.amplitude.constant.AmplitudeConstants.VALUE;
import static com.bytechef.component.amplitude.util.AmplitudeUtils.getEventJson;
import static com.bytechef.component.definition.ComponentDsl.action;
import static com.bytechef.component.definition.ComponentDsl.object;
import static com.bytechef.component.definition.ComponentDsl.option;
import static com.bytechef.component.definition.ComponentDsl.outputSchema;
import static com.bytechef.component.definition.ComponentDsl.string;
import static com.bytechef.component.definition.Context.Http.responseType;

import com.bytechef.component.amplitude.util.AmplitudeUtils;
import com.bytechef.component.definition.ComponentDsl.ModifiableActionDefinition;
import com.bytechef.component.definition.Context;
import com.bytechef.component.definition.Context.Http.ResponseType;
import com.bytechef.component.definition.OptionsDataSource.ActionOptionsFunction;
import com.bytechef.component.definition.Parameters;

/**
* @author Nikolina Spehar
*/
public class AmplitudeCreateAttributionEventAction {

public static final ModifiableActionDefinition ACTION_DEFINITION = action("createAttributionEvent")
.title("Create Attribution Event")
.description("Creates attribution event using Attribution API.")
.properties(
string(EVENT_TYPE)
.label("Event Type")
.description("The event info. Prefix with brackets [YOUR COMPANY].")
.required(true),
string(PLATFORM)
.label("Platform")
.description("Platform which the event will occur on.")
.options(
option("iOS", "ios"),
option("Android", "android"))
.required(true),
object(IDENTIFIER)
.label("Identifier")
.description("Identifier of the platform.")
.required(true)
.properties(
string(KEY)
.label("Identifier Key")
.description(
"For iOS input the Identifier for Advertiser or the Identifier for Vendor.For Android " +
"input the Google ADID or App Set ID.")
.options((ActionOptionsFunction<String>) AmplitudeUtils::getIdentifierKeyOptions)
.optionsLookupDependsOn(PLATFORM)
.required(true),
string(VALUE)
.label("Identifier Value")
.description("Value of selected identifier.")
.required(true)),
USER_PROPERTIES_OBJECT)
.output(
outputSchema(
string()
.description("Response message")))
.perform(AmplitudeCreateAttributionEventAction::perform);

private AmplitudeCreateAttributionEventAction() {
}

public static String perform(Parameters inputParameters, Parameters connectionParameters, Context context) {
return context.http(http -> http.post("/attribution"))
.configuration(responseType(ResponseType.TEXT))
.queryParameters(
API_KEY, connectionParameters.getRequiredString(API_KEY),
EVENT, getEventJson(inputParameters, context))
.execute()
.getBody(String.class);
}
}
Loading