Skip to content

Commit

Permalink
chore(contact-center): migrate code from googleapis/nodejs-contact-ce…
Browse files Browse the repository at this point in the history
…nter-insights (#2817)

- feat: initial generation of templated files
- feat: add initial samples (#2)
- chore(deps): update dependency mocha to v9 (#3)
- chore: release 1.0.0 (#1)
- chore: release 1.0.1 (#12)
- chore: release 1.0.2 (#18)
- chore: release 1.1.0 (#21)
- chore: release 1.2.0 (#26)
- chore: release 1.2.1 (#29)
- chore: release 1.3.0 (#36)
- chore: release 1.4.0 (#40)
- samples: get operation (#52)
- samples: create conversation, create analysis, export data to BigQuery (#34)
- samples: enable pubsub notifications (#48)
- samples: modify TTL in create conversation with TTL sample (#57)
- samples: create topic model (#49)
- chore: release 1.5.0 (#58)
- samples: set project-level TTL (#51)
- samples: create custom highlights (#53)
- chore: release 1.6.0 (#65)
- chore: release 1.7.0 (#69)
- chore: release 1.8.0 (#75)
- chore: release 1.9.0 (#81)
- chore(main): release 1.11.0 (#107)
- build: add retries for flaky test (#109)
- build!: update library to use Node 12 (#122)
- chore(main): release 2.0.0 (#124)
- fix(deps): update dependency @google-cloud/bigquery to v6 (#127)
- fix(deps): update dependency @google-cloud/pubsub to v3 (#126)
- chore(main): release 2.0.1 (#129)
- chore(main): release 2.1.0 (#134)
- chore(main): release 2.1.1 (#139)
- chore(deps): update dependency uuid to v9 (#142)
  • Loading branch information
telpirion authored Nov 9, 2022
1 parent e35f9de commit bef7132
Show file tree
Hide file tree
Showing 24 changed files with 1,362 additions and 1 deletion.
67 changes: 67 additions & 0 deletions .github/workflows/contact-center-insights.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: contact-center-insights
on:
push:
branches:
- main
paths:
- 'contact-center-insights/**'
pull_request:
paths:
- 'contact-center-insights/**'
pull_request_target:
types: [labeled]
schedule:
- cron: '0 0 * * 0'
jobs:
test:
if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }}
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: 'write'
pull-requests: 'write'
id-token: 'write'
steps:
- uses: actions/checkout@v3.1.0
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: 'google-github-actions/auth@v0.8.3'
with:
workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider'
service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com'
create_credentials_file: 'true'
access_token_lifetime: 600s
- uses: actions/setup-node@v3.5.1
with:
node-version: 16
- run: npm install
working-directory: contact-center-insights
- run: npm test
working-directory: contact-center-insights
env:
MOCHA_REPORTER_SUITENAME: contact_center_insights
MOCHA_REPORTER_OUTPUT: contact_center_insights_sponge_log.xml
MOCHA_REPORTER: xunit
- if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
try {
await github.rest.issues.removeLabel({
name: 'actions:force-run',
owner: 'GoogleCloudPlatform',
repo: 'nodejs-docs-samples',
issue_number: context.payload.pull_request.number
});
} catch (e) {
if (!e.message.includes('Label does not exist')) {
throw e;
}
}
- if: ${{ github.event_name == 'schedule'}}
run: |
curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L
chmod +x ./flakybot
./flakybot --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
3 changes: 2 additions & 1 deletion .github/workflows/workflows.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@
"datacatalog/cloud-client",
"datacatalog/quickstart",
"datastore/functions",
"talent"
"talent",
"contact-center-insights"
]
3 changes: 3 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ composer @leahecole @sofisl @GoogleCloudPlatform/nodejs-samples-reviewers
healthcare @noerog @GoogleCloudPlatform/nodejs-samples-reviewers
monitoring/opencensus @GoogleCloudPlatform/nodejs-samples-reviewers

# Data & AI
contact-center-insights @GoogleCloudPlatform/dee-data-ai @GoogleCloudPlatform/nodejs-samples-reviewers
talent @GoogleCloudPlatform/dee-data-ai @GoogleCloudPlatform/nodejs-samples-reviewers
50 changes: 50 additions & 0 deletions contact-center-insights/createAnalysis.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Copyright 2021 Google LLC
//
// 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.
//

'use strict';

function main(conversationName) {
// [START contactcenterinsights_create_analysis]
/**
* TODO(developer): Uncomment this variable before running the sample.
*/
// const conversationName = 'projects/my_project_id/locations/us-central1/conversations/my_conversation_id';

// Imports the Contact Center Insights client.
const {
ContactCenterInsightsClient,
} = require('@google-cloud/contact-center-insights');

// Instantiates a client.
const client = new ContactCenterInsightsClient();

async function createAnalysis() {
const [operation] = await client.createAnalysis({
parent: conversationName,
});

// Wait for the operation to complete.
const [analysis] = await operation.promise();
console.info(`Created ${analysis.name}`);
}
createAnalysis();
// [END contactcenterinsights_create_analysis]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
62 changes: 62 additions & 0 deletions contact-center-insights/createConversation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Copyright 2021 Google LLC
//
// 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.
//

'use strict';

function main(
projectId,
transcriptUri = 'gs://cloud-samples-data/ccai/chat_sample.json',
audioUri = 'gs://cloud-samples-data/ccai/voice_6912.txt'
) {
// [START contactcenterinsights_create_conversation]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
// const projectId = 'my_project_id';
// const transcriptUri = 'gs://cloud-samples-data/ccai/chat_sample.json';
// const audioUri = 'gs://cloud-samples-data/ccai/voice_6912.txt';

// Imports the Contact Center Insights client.
const {
ContactCenterInsightsClient,
} = require('@google-cloud/contact-center-insights');

// Instantiates a client.
const client = new ContactCenterInsightsClient();

async function createConversation() {
const [conversation] = await client.createConversation({
parent: client.locationPath(projectId, 'us-central1'),
conversation: {
dataSource: {
gcsSource: {
transcriptUri: transcriptUri,
audioUri: audioUri,
},
},
medium: 'CHAT',
},
});
console.info(`Created ${conversation.name}`);
}
createConversation();
// [END contactcenterinsights_create_conversation]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
65 changes: 65 additions & 0 deletions contact-center-insights/createConversationWithTtl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Copyright 2021 Google LLC
//
// 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.
//

'use strict';

function main(
projectId,
transcriptUri = 'gs://cloud-samples-data/ccai/chat_sample.json',
audioUri = 'gs://cloud-samples-data/ccai/voice_6912.txt'
) {
// [START contactcenterinsights_create_conversation_with_ttl]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
// const projectId = 'my_project_id';
// const transcriptUri = 'gs://cloud-samples-data/ccai/chat_sample.json';
// const audioUri = 'gs://cloud-samples-data/ccai/voice_6912.txt';

// Imports the Contact Center Insights client.
const {
ContactCenterInsightsClient,
} = require('@google-cloud/contact-center-insights');

// Instantiates a client.
const client = new ContactCenterInsightsClient();

async function createConversationWithTtl() {
const [conversation] = await client.createConversation({
parent: client.locationPath(projectId, 'us-central1'),
conversation: {
dataSource: {
gcsSource: {
transcriptUri: transcriptUri,
audioUri: audioUri,
},
},
medium: 'CHAT',
ttl: {
seconds: 86400,
},
},
});
console.info(`Created ${conversation.name}`);
}
createConversationWithTtl();
// [END contactcenterinsights_create_conversation_with_ttl]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
56 changes: 56 additions & 0 deletions contact-center-insights/createIssueModel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright 2021 Google LLC
//
// 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.
//

'use strict';

function main(projectId) {
// [START contactcenterinsights_create_issue_model]
/**
* TODO(developer): Uncomment this variable before running the sample.
*/
// const projectId = 'my_project_id';

// Imports the Contact Center Insights client.
const {
ContactCenterInsightsClient,
} = require('@google-cloud/contact-center-insights');

// Instantiates a client.
const client = new ContactCenterInsightsClient();

async function createIssueModel() {
const [operation] = await client.createIssueModel({
parent: client.locationPath(projectId, 'us-central1'),
issueModel: {
displayName: 'my-model',
inputDataConfig: {
filter: 'medium="CHAT"',
},
},
});

// Wait for the operation to complete.
const [issueModel] = await operation.promise();
console.info(`Created ${issueModel.name}`);
}
createIssueModel();
// [END contactcenterinsights_create_issue_model]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Loading

0 comments on commit bef7132

Please sign in to comment.