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

release 6.2412.49 #226

Closed
wants to merge 17 commits into from
Closed
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@ tsconfig.tsbuildinfo
playwright-report
test-results
user.json

# JetBrains
.idea
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ First of all, thank you so much for taking your time to contribute! ABC User Fee
to report bugs and propose new features and improvements.
- Ask a question using [the issue tracker](https://github.com/line/abc-user-feedback/issues).
- Contribute your work by sending [a pull request](https://github.com/line/abc-user-feedback/pulls).
- You should make your pull request base branch as `dev` not `main`. After merging to `dev` branch, we test the pull request in our separate environment and if there is no issue, it would be merged to `main` and released.

## Contributor license agreement

Expand Down
175 changes: 175 additions & 0 deletions GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,178 @@ Depending on your use case and the desired level of access, you may need to adju
Users can specify a whitelist of domains for image URLs. This ensures that only images from trusted sources are accepted and managed by User Feedback API server.

**Note**: The domain whitelist is enforced at the time of posting feedback with images. This means that validation against the whitelist occurs only during the submission of new feedback. Once an image URL has been uploaded to the database and accepted, it will be accessible through the web admin interface regardless of its current status on the whitelist. It is important to ensure that image URLs are from trusted sources before they are uploaded, as subsequent changes to the whitelist will not retroactively affect previously stored image URLs.

## Webhook Feature

### Introduction to Webhooks

Webhooks in ABC User Feedback provide a powerful way to integrate with external services. They allow you to receive real-time notifications when specific events occur within the application, such as new feedback submissions or issue updates.

Furthermore, you can combine webhooks with ABC User Feedback API to make more powerful features such as translation, sentiment analysis or whatever you want. Just make a webhook listener and build your own script and send the result to ABC User Feedback by API.

### Setting Up Webhooks

To set up webhooks in ABC User Feedback:

1. Navigate to the project settings where you want to enable webhooks.
2. Add a new webhook by providing the URL endpoint that ABC User Feedback will send the data to when events occur.
3. Turn on the events you wish to subscribe to.
4. Save the webhook configuration.

Ensure that the endpoint you provide is secure and can accept POST requests with a JSON payload.

### Event Types and Request Bodies

ABC User Feedback's webhook supports the following event types, each with its own specific payload structure:

#### FEEDBACK_CREATION

This event is triggered when a new piece of feedback is created.

**Payload Structure:**

```json
{
"event": "FEEDBACK_CREATION",
"data": {
"feedback": {
"id": 1,
"createdAt": "2023-04-02T15:30:00Z",
"updatedAt": "2023-04-02T15:30:00Z",
"issues": [
{
"id": 1,
"createdAt": "2023-04-02T15:30:00Z",
"updatedAt": "2023-04-02T15:30:00Z",
"name": "issue name",
"description": "issue description",
"status": "INIT",
"externalIssueId": "123",
"feedbackCount": 1
}
]
},
"channel": {
"id": 1,
"name": "channel name"
},
"project": {
"id": 1,
"name": "project name"
}
}
}
```

#### ISSUE_ADDITION

This event is triggered when an issue is added to an existing piece of feedback.

**Payload Structure:**

```json
{
"event": "ISSUE_ADDITION",
"data": {
"feedback": {
"id": 1,
"createdAt": "2023-04-02T15:30:00Z",
"updatedAt": "2023-04-02T15:30:00Z",
"issues": [
{
"id": 1,
"createdAt": "2023-04-02T15:30:00Z",
"updatedAt": "2023-04-02T15:30:00Z",
"name": "issue name",
"description": "issue description",
"status": "INIT",
"externalIssueId": "123",
"feedbackCount": 1
}
]
},
"channel": {
"id": 1,
"name": "channel name"
},
"project": {
"id": 1,
"name": "project name"
},
"addedIssue": {
"id": 1,
"createdAt": "2023-04-02T15:30:00Z",
"updatedAt": "2023-04-02T15:30:00Z",
"name": "issue name",
"description": "issue description",
"status": "INIT",
"externalIssueId": "123",
"feedbackCount": 1
}
}
}
```

#### ISSUE_CREATION

This event is triggered when a new issue is created within a project.

**Payload Structure:**

```json
{
"event": "ISSUE_CREATION",
"data": {
"issue": {
"id": 1,
"createdAt": "2023-04-02T15:30:00Z",
"updatedAt": "2023-04-02T15:30:00Z",
"name": "issue name",
"description": "issue description",
"status": "INIT",
"externalIssueId": "123",
"feedbackCount": 1
},
"project": {
"id": 1,
"name": "project name"
}
}
}
```

#### ISSUE_STATUS_CHANGE

This event is triggered when the status of an issue is updated.

**Payload Structure:**

```json
{
"event": "ISSUE_STATUS_CHANGE",
"data": {
"issue": {
"id": 1,
"createdAt": "2023-04-02T15:30:00Z",
"updatedAt": "2023-04-02T15:30:00Z",
"name": "issue name",
"description": "issue description",
"status": "ON_REVIEW",
"externalIssueId": "123",
"feedbackCount": 1
},
"project": {
"id": 1,
"name": "project name"
},
"previousStatus": "INIT"
}
}
```

### Handling Webhooks

Upon receiving a webhook payload, your endpoint should:

Parse the JSON payload.
Take appropriate action based on the event type and data received.
8 changes: 4 additions & 4 deletions apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"@nestjs/event-emitter": "^2.0.4",
"@nestjs/jwt": "^10.1.1",
"@nestjs/passport": "^10.0.3",
"@nestjs/platform-express": "^10.2.7",
"@nestjs/platform-fastify": "^10.2.7",
"@nestjs/platform-express": "^10.3.3",
"@nestjs/platform-fastify": "^10.3.3",
"@nestjs/schedule": "^4.0.0",
"@nestjs/swagger": "^7.1.14",
"@nestjs/terminus": "^10.1.1",
Expand Down Expand Up @@ -70,14 +70,14 @@
"reflect-metadata": "^0.1.13",
"rxjs": "^7.8.1",
"source-map-support": "^0.5.21",
"typeorm": "^0.3.17",
"typeorm": "^0.3.20",
"typeorm-naming-strategies": "^4.1.0",
"typeorm-transactional": "^0.4.1"
},
"devDependencies": {
"@faker-js/faker": "^8.2.0",
"@nestjs/cli": "^10.2.0",
"@nestjs/schematics": "^10.0.2",
"@nestjs/schematics": "^10.1.1",
"@nestjs/testing": "^10.2.7",
"@swc-node/jest": "^1.6.8",
"@swc/core": "^1.3.95",
Expand Down
4 changes: 4 additions & 0 deletions apps/api/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import { IssueModule } from './domains/admin/project/issue/issue.module';
import { MemberModule } from './domains/admin/project/member/member.module';
import { ProjectModule } from './domains/admin/project/project/project.module';
import { RoleModule } from './domains/admin/project/role/role.module';
import { WebhookModule } from './domains/admin/project/webhook/webhook.module';
import { FeedbackIssueStatisticsModule } from './domains/admin/statistics/feedback-issue/feedback-issue-statistics.module';
import { FeedbackStatisticsModule } from './domains/admin/statistics/feedback/feedback-statistics.module';
import { IssueStatisticsModule } from './domains/admin/statistics/issue/issue-statistics.module';
Expand All @@ -54,6 +55,7 @@ import { UserModule } from './domains/admin/user/user.module';
import { APIModule } from './domains/api/api.module';
import { HealthModule } from './domains/operation/health/health.module';
import { MigrationModule } from './domains/operation/migration/migration.module';
import { SchedulerLockModule } from './domains/operation/scheduler-lock/scheduler-lock.module';

export const domainModules = [
AuthModule,
Expand All @@ -72,10 +74,12 @@ export const domainModules = [
UserModule,
MemberModule,
HistoryModule,
WebhookModule,
FeedbackStatisticsModule,
IssueStatisticsModule,
FeedbackIssueStatisticsModule,
APIModule,
SchedulerLockModule,
] as any[];

@Module({
Expand Down
19 changes: 19 additions & 0 deletions apps/api/src/common/enums/event-status.enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Copyright 2023 LINE Corporation
*
* LINE Corporation licenses this file to you 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.
*/
export enum EventStatusEnum {
ACTIVE = 'ACTIVE',
INACTIVE = 'INACTIVE',
}
21 changes: 21 additions & 0 deletions apps/api/src/common/enums/event-type.enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Copyright 2023 LINE Corporation
*
* LINE Corporation licenses this file to you 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.
*/
export enum EventTypeEnum {
FEEDBACK_CREATION = 'FEEDBACK_CREATION',
ISSUE_CREATION = 'ISSUE_CREATION',
ISSUE_STATUS_CHANGE = 'ISSUE_STATUS_CHANGE',
ISSUE_ADDITION = 'ISSUE_ADDITION',
}
3 changes: 3 additions & 0 deletions apps/api/src/common/enums/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ export { FieldTypeEnum } from './field-type.enum';
export { FieldStatusEnum } from './field-status.enum';
export { IssueStatusEnum } from './issue-status.enum';
export { SortMethodEnum } from './sort-method.enum';
export { EventTypeEnum } from './event-type.enum';
export { EventStatusEnum } from './event-status.enum';
export { WebhookStatusEnum } from './webhook-status.enum';
19 changes: 19 additions & 0 deletions apps/api/src/common/enums/webhook-status.enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Copyright 2023 LINE Corporation
*
* LINE Corporation licenses this file to you 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.
*/
export enum WebhookStatusEnum {
ACTIVE = 'ACTIVE',
INACTIVE = 'INACTIVE',
}
2 changes: 2 additions & 0 deletions apps/api/src/configs/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import { registerAs } from '@nestjs/config';
import Joi from 'joi';
import { v4 as uuidv4 } from 'uuid';

export const appConfigSchema = Joi.object({
APP_PORT: Joi.number().default(4000),
Expand All @@ -25,4 +26,5 @@ export const appConfigSchema = Joi.object({
export const appConfig = registerAs('app', () => ({
port: process.env.APP_PORT,
address: process.env.APP_ADDRESS,
serverId: uuidv4(),
}));
Loading
Loading