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
39 changes: 39 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.PHONY: all build test test-verbose vet fmt fmt-check lint tidy clean

PACKAGES := ./...
FMT_FILES := $(shell find . -name "*.go")
BINARY := terraform-provider-chatbotkit

all: vet build test

build:
go build -o $(BINARY) .

test:
go test -race -count=1 $(PACKAGES)

test-verbose:
go test -race -count=1 -v $(PACKAGES)

vet:
go vet $(PACKAGES)

fmt:
gofmt -w $(FMT_FILES)

fmt-check:
@test -z "$$(gofmt -l $(FMT_FILES))" || (echo "Files not formatted:"; gofmt -l $(FMT_FILES); exit 1)

lint: vet fmt-check
@if command -v golangci-lint > /dev/null 2>&1; then \
golangci-lint run $(PACKAGES); \
else \
echo "golangci-lint not installed — skipping (run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest)"; \
fi

tidy:
go mod tidy

clean:
go clean -testcache
rm -f $(BINARY)
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.1
1.1.0
8 changes: 4 additions & 4 deletions docs/resources/trigger_integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ resource "chatbotkit_trigger_integration" "scheduled" {
description = "Run bot check every hour"
bot_id = chatbotkit_bot.assistant.id

trigger_schedule = "0 * * * *" # Every hour
schedule = "0 * * * *" # Every hour
session_duration = 300000 # 5 minutes
}
```
Expand Down Expand Up @@ -64,7 +64,7 @@ resource "chatbotkit_trigger_integration" "from_template" {
description = "Created from template"
blueprint_id = chatbotkit_blueprint.trigger_template.id
bot_id = chatbotkit_bot.assistant.id
trigger_schedule = "*/30 * * * *" # Every 30 minutes
schedule = "*/30 * * * *" # Every 30 minutes
}
```

Expand All @@ -76,7 +76,7 @@ resource "chatbotkit_trigger_integration" "full" {
description = "Complete trigger setup"
bot_id = chatbotkit_bot.assistant.id

trigger_schedule = "0 9 * * 1-5" # 9 AM on weekdays
schedule = "0 9 * * 1-5" # 9 AM on weekdays
session_duration = 600000 # 10 minutes
authenticate = true

Expand All @@ -94,7 +94,7 @@ The following arguments are supported:
- `name` - (Optional) The name of the integration. This is displayed in the ChatBotKit dashboard.
- `description` - (Optional) A description of the integration's purpose.
- `bot_id` - (Optional) The ID of the ChatBotKit bot to connect.
- `trigger_schedule` - (Optional) A cron expression for scheduled trigger execution.
- `schedule` - (Optional) A cron expression for scheduled trigger execution.
- `session_duration` - (Optional) The duration of a trigger session in milliseconds.
- `authenticate` - (Optional) Whether to require authentication for webhook triggers.
- `blueprint_id` - (Optional) The ID of a blueprint to associate with this integration.
Expand Down
2 changes: 1 addition & 1 deletion examples/complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ resource "chatbotkit_trigger_integration" "scheduled_trigger" {
name = "Daily Report Trigger"
description = "Runs daily to generate reports"
bot_id = chatbotkit_bot.assistant.id
trigger_schedule = "daily"
schedule = "daily"
}
```

Expand Down
2 changes: 1 addition & 1 deletion examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ resource "chatbotkit_trigger_integration" "bot_trigger" {
bot_id = chatbotkit_bot.assistant.id

# Optional: Set a schedule (e.g., "hourly", "daily", "weekly")
# trigger_schedule = "never"
# schedule = "never"
}

# ============================================================================
Expand Down
2 changes: 1 addition & 1 deletion examples/dual-agent-programmable-workflows/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ resource "chatbotkit_trigger_integration" "scheduled_trigger" {
description = "Automated trigger for scheduled workflow execution by the Task Runner"
authenticate = true
session_duration = 1800000
trigger_schedule = "hourly"
schedule = "hourly"
}

# ============================================================================
Expand Down
2 changes: 1 addition & 1 deletion examples/system-diagnostics-agent/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ resource "chatbotkit_trigger_integration" "diagnostic_schedule" {
description = "Automated trigger for periodic system diagnostics and health checks"
authenticate = true
session_duration = 1800000
trigger_schedule = "daily"
schedule = "daily"
}

# ============================================================================
Expand Down
2 changes: 1 addition & 1 deletion examples/workflow-orchestrator/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ resource "chatbotkit_trigger_integration" "workflow_trigger" {
description = "Manual or scheduled trigger for workflow execution"
authenticate = true
session_duration = 3600000
trigger_schedule = "never"
schedule = "never"
}

# ============================================================================
Expand Down
8 changes: 4 additions & 4 deletions internal/provider/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3264,7 +3264,7 @@ type CreateTriggerIntegrationInput struct {
Meta map[string]interface{} `json:"meta,omitempty"`
Name *string `json:"name,omitempty"`
SessionDuration *int64 `json:"sessionDuration,omitempty"`
TriggerSchedule *string `json:"triggerSchedule,omitempty"`
Schedule *string `json:"schedule,omitempty"`
}

// CreateTriggerIntegrationResponse represents the response from creating a triggerintegration.
Expand Down Expand Up @@ -3306,7 +3306,7 @@ type UpdateTriggerIntegrationInput struct {
Meta map[string]interface{} `json:"meta,omitempty"`
Name *string `json:"name,omitempty"`
SessionDuration *int64 `json:"sessionDuration,omitempty"`
TriggerSchedule *string `json:"triggerSchedule,omitempty"`
Schedule *string `json:"schedule,omitempty"`
}

// UpdateTriggerIntegrationResponse represents the response from updating a triggerintegration.
Expand Down Expand Up @@ -3380,7 +3380,7 @@ type GetTriggerIntegrationResponse struct {
Meta map[string]interface{} `json:"meta,omitempty"`
Name *string `json:"name,omitempty"`
SessionDuration *int64 `json:"sessionDuration,omitempty"`
TriggerSchedule *string `json:"triggerSchedule,omitempty"`
Schedule *string `json:"schedule,omitempty"`
CreatedAt *string `json:"createdAt,omitempty"`
UpdatedAt *string `json:"updatedAt,omitempty"`
}
Expand All @@ -3401,7 +3401,7 @@ func (c *Client) GetTriggerIntegration(ctx context.Context, id string) (*GetTrig
meta
name
sessionDuration
triggerSchedule
schedule
createdAt
updatedAt
}
Expand Down
12 changes: 6 additions & 6 deletions internal/provider/resource_trigger_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type TriggerIntegrationResourceModel struct {
Meta types.Map `tfsdk:"meta"`
Name types.String `tfsdk:"name"`
SessionDuration types.Int64 `tfsdk:"session_duration"`
TriggerSchedule types.String `tfsdk:"trigger_schedule"`
Schedule types.String `tfsdk:"schedule"`
CreatedAt types.String `tfsdk:"created_at"`
UpdatedAt types.String `tfsdk:"updated_at"`
}
Expand Down Expand Up @@ -91,7 +91,7 @@ func (r *TriggerIntegrationResource) Schema(ctx context.Context, req resource.Sc
MarkdownDescription: "The duration of the session in milliseconds",
Optional: true,
},
"trigger_schedule": schema.StringAttribute{
"schedule": schema.StringAttribute{
MarkdownDescription: "The schedule for automatic trigger execution",
Optional: true,
},
Expand Down Expand Up @@ -146,7 +146,7 @@ func (r *TriggerIntegrationResource) Create(ctx context.Context, req resource.Cr
Meta: convertMapToInterface(ctx, data.Meta),
Name: data.Name.ValueStringPointer(),
SessionDuration: data.SessionDuration.ValueInt64Pointer(),
TriggerSchedule: data.TriggerSchedule.ValueStringPointer(),
Schedule: data.Schedule.ValueStringPointer(),
})
if err != nil {
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to create triggerintegration: %s", err))
Expand Down Expand Up @@ -211,8 +211,8 @@ func (r *TriggerIntegrationResource) Read(ctx context.Context, req resource.Read
if result.SessionDuration != nil {
data.SessionDuration = types.Int64PointerValue(result.SessionDuration)
}
if result.TriggerSchedule != nil {
data.TriggerSchedule = types.StringPointerValue(result.TriggerSchedule)
if result.Schedule != nil {
data.Schedule = types.StringPointerValue(result.Schedule)
}
if result.CreatedAt != nil {
data.CreatedAt = types.StringPointerValue(result.CreatedAt)
Expand Down Expand Up @@ -246,7 +246,7 @@ func (r *TriggerIntegrationResource) Update(ctx context.Context, req resource.Up
Meta: convertMapToInterface(ctx, data.Meta),
Name: data.Name.ValueStringPointer(),
SessionDuration: data.SessionDuration.ValueInt64Pointer(),
TriggerSchedule: data.TriggerSchedule.ValueStringPointer(),
Schedule: data.Schedule.ValueStringPointer(),
})
if err != nil {
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to update triggerintegration: %s", err))
Expand Down
6 changes: 3 additions & 3 deletions types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2823,7 +2823,7 @@ type TriggerIntegration struct {
// The session duration for the trigger integration
SessionDuration *float64 `json:"sessionDuration,omitempty"`
// The schedule for the trigger integration
TriggerSchedule *string `json:"triggerSchedule,omitempty"`
Schedule *string `json:"schedule,omitempty"`
// The date and time when the trigger integration was last updated
UpdatedAt *string `json:"updatedAt,omitempty"`
}
Expand All @@ -2849,7 +2849,7 @@ type TriggerIntegrationCreateRequest struct {
// The duration of the session in milliseconds
SessionDuration *int64 `json:"sessionDuration,omitempty"`
// The schedule for automatic trigger execution
TriggerSchedule *string `json:"triggerSchedule,omitempty"`
Schedule *string `json:"schedule,omitempty"`
}

// TriggerIntegrationCreateResponse Response containing the ID of a newly created Trigger integration
Expand Down Expand Up @@ -2885,7 +2885,7 @@ type TriggerIntegrationUpdateRequest struct {
// The duration of the session in milliseconds
SessionDuration *int64 `json:"sessionDuration,omitempty"`
// The schedule for automatic trigger execution
TriggerSchedule *string `json:"triggerSchedule,omitempty"`
Schedule *string `json:"schedule,omitempty"`
}

// TriggerIntegrationUpdateResponse Response containing the ID of an updated Trigger integration
Expand Down
Loading