-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4932 from drona2938/codespace-legendary-garbanzo-…
…q9995r99p4pfx6px feat(fliqr-ai): Get Account Details and Get Account Flows actions
- Loading branch information
Showing
12 changed files
with
229 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"extends": [ | ||
"../../../../.eslintrc.base.json" | ||
], | ||
"ignorePatterns": [ | ||
"!**/*" | ||
], | ||
"overrides": [ | ||
{ | ||
"files": [ | ||
"*.ts", | ||
"*.tsx", | ||
"*.js", | ||
"*.jsx" | ||
], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": [ | ||
"*.ts", | ||
"*.tsx" | ||
], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": [ | ||
"*.js", | ||
"*.jsx" | ||
], | ||
"rules": {} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# pieces-fliqr-ai | ||
|
||
This library was generated with [Nx](https://nx.dev). | ||
|
||
## Building | ||
|
||
Run `nx build pieces-fliqr-ai` to build the library. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "@activepieces/piece-fliqr-ai", | ||
"version": "0.0.1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"name": "pieces-fliqr-ai", | ||
"$schema": "../../../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "packages/pieces/community/fliqr-ai/src", | ||
"projectType": "library", | ||
"targets": { | ||
"build": { | ||
"executor": "@nx/js:tsc", | ||
"outputs": [ | ||
"{options.outputPath}" | ||
], | ||
"options": { | ||
"outputPath": "dist/packages/pieces/community/fliqr-ai", | ||
"tsConfig": "packages/pieces/community/fliqr-ai/tsconfig.lib.json", | ||
"packageJson": "packages/pieces/community/fliqr-ai/package.json", | ||
"main": "packages/pieces/community/fliqr-ai/src/index.ts", | ||
"assets": [ | ||
"packages/pieces/community/fliqr-ai/*.md" | ||
], | ||
"buildableProjectDepsInPackageJsonType": "dependencies", | ||
"updateBuildableProjectDepsInPackageJson": true | ||
} | ||
}, | ||
"publish": { | ||
"command": "node tools/scripts/publish.mjs pieces-fliqr-ai {args.ver} {args.tag}", | ||
"dependsOn": [ | ||
"build" | ||
] | ||
}, | ||
"lint": { | ||
"executor": "@nx/eslint:lint", | ||
"outputs": [ | ||
"{options.outputFile}" | ||
] | ||
} | ||
}, | ||
"tags": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { HttpMethod, createCustomApiCallAction, httpClient } from '@activepieces/pieces-common'; | ||
import { PieceAuth, createPiece } from '@activepieces/pieces-framework'; | ||
import { getFliqrAccountDetails } from './lib/actions/get-account-details'; | ||
import { fliqrConfig } from './lib/common/models'; | ||
import { getFliqrAccountFlows } from './lib/actions/get-account-flows'; | ||
import { PieceCategory } from '@activepieces/shared'; | ||
|
||
export const fliqrAuth = PieceAuth.SecretText({ | ||
displayName: 'Fliqr API Access Token', | ||
required: true, | ||
description: ` | ||
To obtain your Fliqr API access token, follow these steps: | ||
1. Log in to your Fliqr account. | ||
2. Navigate to Fliqr API Access Token Settings. | ||
3. Under the Integrations section, find the Fliqr API Access Token. | ||
4. Click on Copy Token to copy your existing token or click on Generate Token to create a new one. | ||
5. Copy the token and paste it below in "Fliqr API Access Token". | ||
`, | ||
validate: async (auth) => { | ||
try { | ||
await httpClient.sendRequest<string[]>({ | ||
method: HttpMethod.GET, | ||
url: `${fliqrConfig.baseUrl}/accounts/me`, | ||
headers: { | ||
[fliqrConfig.accessTokenHeaderKey]: auth.auth, | ||
}, | ||
}); | ||
return { | ||
valid: true, | ||
}; | ||
} catch (e) { | ||
return { | ||
valid: false, | ||
error: 'Invalid personal access token', | ||
}; | ||
} | ||
}, | ||
}); | ||
|
||
export const fliqrAi = createPiece({ | ||
displayName: 'Fliqr AI', | ||
description: | ||
'Omnichannel AI chatbot enhancing customer interactions across WhatsApp, Facebook, Instagram, Telegram, and 6 other platforms.', | ||
|
||
minimumSupportedRelease: '0.20.0', | ||
logoUrl: 'https://cdn.activepieces.com/pieces/fliqr-ai.png', | ||
authors: ["drona2938"], | ||
categories: [PieceCategory.COMMUNICATION,PieceCategory.CUSTOMER_SUPPORT,PieceCategory.MARKETING], | ||
auth: fliqrAuth, | ||
actions: [ getFliqrAccountDetails, | ||
getFliqrAccountFlows, | ||
createCustomApiCallAction({ | ||
baseUrl: () => fliqrConfig.baseUrl, | ||
auth: fliqrAuth, | ||
authMapping: (auth) => ({ | ||
[fliqrConfig.accessTokenHeaderKey]: `${auth}`, | ||
}), | ||
}), | ||
], | ||
triggers: [], | ||
}); |
24 changes: 24 additions & 0 deletions
24
packages/pieces/community/fliqr-ai/src/lib/actions/get-account-details.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { createAction } from '@activepieces/pieces-framework'; | ||
import { httpClient, HttpMethod } from '@activepieces/pieces-common'; | ||
import { fliqrAuth } from '../../index'; | ||
import { fliqrConfig } from '../common/models'; | ||
|
||
|
||
export const getFliqrAccountDetails = createAction({ | ||
// auth: check https://www.activepieces.com/docs/developers/piece-reference/authentication, | ||
name: 'get_fliqr_account_details', | ||
auth: fliqrAuth, | ||
displayName: 'Get Business Account details', | ||
description: 'Get basic account details of business', | ||
props: {}, | ||
async run(context) { | ||
const res = await httpClient.sendRequest<string[]>({ | ||
method: HttpMethod.GET, | ||
url: `${fliqrConfig.baseUrl}/accounts/me`, | ||
headers: { | ||
[fliqrConfig.accessTokenHeaderKey]: context.auth, | ||
}, | ||
}); | ||
return res.body; | ||
}, | ||
}); |
23 changes: 23 additions & 0 deletions
23
packages/pieces/community/fliqr-ai/src/lib/actions/get-account-flows.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { httpClient, HttpMethod } from '@activepieces/pieces-common'; | ||
import { createAction } from '@activepieces/pieces-framework'; | ||
import { fliqrConfig } from '../common/models'; | ||
import { fliqrAuth } from '../../index'; | ||
|
||
export const getFliqrAccountFlows = createAction({ | ||
// auth: check https://www.activepieces.com/docs/developers/piece-reference/authentication, | ||
name: 'get_fliqr_account_flows', | ||
auth: fliqrAuth, | ||
displayName: 'Get Account Flows', | ||
description: 'Get all flows from the account', | ||
props: {}, | ||
async run(context) { | ||
const res = await httpClient.sendRequest<string[]>({ | ||
method: HttpMethod.GET, | ||
url: `${fliqrConfig.baseUrl}/accounts/flows`, | ||
headers: { | ||
[fliqrConfig.accessTokenHeaderKey]: context.auth, | ||
} | ||
}); | ||
return res.body; | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const fliqrConfig = { | ||
baseUrl: 'https://app.fliqr.ai/api', | ||
accessTokenHeaderKey: 'X-ACCESS-TOKEN', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"extends": "../../../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": true, | ||
"noImplicitOverride": true, | ||
"noPropertyAccessFromIndexSignature": true, | ||
"noImplicitReturns": true, | ||
"noFallthroughCasesInSwitch": true | ||
}, | ||
"files": [], | ||
"include": [], | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.lib.json" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"outDir": "../../../../dist/out-tsc", | ||
"declaration": true, | ||
"types": ["node"] | ||
}, | ||
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"], | ||
"include": ["src/**/*.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters