Skip to content
This repository was archived by the owner on Jul 20, 2023. It is now read-only.
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ Samples are in the [`samples/`](https://github.com/googleapis/nodejs-contact-cen

| Sample | Source Code | Try it |
| --------------------------- | --------------------------------- | ------ |
| Create Analysis | [source code](https://github.com/googleapis/nodejs-contact-center-insights/blob/main/samples/createAnalysis.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-contact-center-insights&page=editor&open_in_editor=samples/createAnalysis.js,samples/README.md) |
| Create Conversation | [source code](https://github.com/googleapis/nodejs-contact-center-insights/blob/main/samples/createConversation.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-contact-center-insights&page=editor&open_in_editor=samples/createConversation.js,samples/README.md) |
| Create Conversation With Ttl | [source code](https://github.com/googleapis/nodejs-contact-center-insights/blob/main/samples/createConversationWithTtl.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-contact-center-insights&page=editor&open_in_editor=samples/createConversationWithTtl.js,samples/README.md) |
| Export To Bigquery | [source code](https://github.com/googleapis/nodejs-contact-center-insights/blob/main/samples/exportToBigquery.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-contact-center-insights&page=editor&open_in_editor=samples/exportToBigquery.js,samples/README.md) |
| Get Operation | [source code](https://github.com/googleapis/nodejs-contact-center-insights/blob/main/samples/getOperation.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-contact-center-insights&page=editor&open_in_editor=samples/getOperation.js,samples/README.md) |
| Quickstart | [source code](https://github.com/googleapis/nodejs-contact-center-insights/blob/main/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-contact-center-insights&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) |

Expand Down
4 changes: 4 additions & 0 deletions linkinator.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
"recurse": true,
"skip": [
"https://codecov.io/gh/googleapis/",
"https://github.com/googleapis/nodejs-contact-center-insights/blob/main/samples/createAnalysis.js",
"https://github.com/googleapis/nodejs-contact-center-insights/blob/main/samples/createConversation.js",
"https://github.com/googleapis/nodejs-contact-center-insights/blob/main/samples/createConversationWithTtl.js",
"https://github.com/googleapis/nodejs-contact-center-insights/blob/main/samples/exportToBigquery.js",
"https://github.com/googleapis/nodejs-contact-center-insights/blob/main/samples/getOperation.js",
"www.googleapis.com",
"img.shields.io"
Expand Down
72 changes: 72 additions & 0 deletions samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

* [Before you begin](#before-you-begin)
* [Samples](#samples)
* [Create Analysis](#create-analysis)
* [Create Conversation](#create-conversation)
* [Create Conversation With Ttl](#create-conversation-with-ttl)
* [Export To Bigquery](#export-to-bigquery)
* [Get Operation](#get-operation)
* [Quickstart](#quickstart)

Expand All @@ -30,6 +34,74 @@ Before running the samples, make sure you've followed the steps outlined in



### Create Analysis

View the [source code](https://github.com/googleapis/nodejs-contact-center-insights/blob/main/samples/createAnalysis.js).

[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-contact-center-insights&page=editor&open_in_editor=samples/createAnalysis.js,samples/README.md)

__Usage:__


`node samples/createAnalysis.js`


-----




### Create Conversation

View the [source code](https://github.com/googleapis/nodejs-contact-center-insights/blob/main/samples/createConversation.js).

[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-contact-center-insights&page=editor&open_in_editor=samples/createConversation.js,samples/README.md)

__Usage:__


`node samples/createConversation.js`


-----




### Create Conversation With Ttl

View the [source code](https://github.com/googleapis/nodejs-contact-center-insights/blob/main/samples/createConversationWithTtl.js).

[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-contact-center-insights&page=editor&open_in_editor=samples/createConversationWithTtl.js,samples/README.md)

__Usage:__


`node samples/createConversationWithTtl.js`


-----




### Export To Bigquery

View the [source code](https://github.com/googleapis/nodejs-contact-center-insights/blob/main/samples/exportToBigquery.js).

[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-contact-center-insights&page=editor&open_in_editor=samples/exportToBigquery.js,samples/README.md)

__Usage:__


`node samples/exportToBigquery.js`


-----




### Get Operation

View the [source code](https://github.com/googleapis/nodejs-contact-center-insights/blob/main/samples/getOperation.js).
Expand Down
50 changes: 50 additions & 0 deletions samples/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 samples/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 samples/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: 600,
},
},
});
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));
59 changes: 59 additions & 0 deletions samples/exportToBigquery.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// 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, bigqueryProjectId, bigqueryDataset, bigqueryTable) {
// [START contactcenterinsights_export_to_bigquery]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
// const projectId = 'my_project_id';
// const bigqueryProjectId = 'my_bigquery_project_id';
// const bigqueryDataset = 'my_bigquery_dataset';
// const bigqueryTable = 'my_bigquery_table';

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

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

async function exportToBigquery() {
const [operation] = await client.exportInsightsData({
parent: client.locationPath(projectId, 'us-central1'),
bigQueryDestination: {
projectId: bigqueryProjectId,
dataset: bigqueryDataset,
table: bigqueryTable,
},
filter: 'agent_id="007"',
});

// Wait for the operation to complete.
await operation.promise();
console.info('Exported data to BigQuery');
}
exportToBigquery();
// [END contactcenterinsights_export_to_bigquery]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
4 changes: 3 additions & 1 deletion samples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
"test": "c8 mocha --timeout 600000 test/*.js"
},
"dependencies": {
"@google-cloud/bigquery": "^5.7.1",
"@google-cloud/contact-center-insights": "^1.4.0"
},
"devDependencies": {
"c8": "^7.1.0",
"chai": "^4.2.0",
"mocha": "^9.0.0"
"mocha": "^9.0.0",
"uuid": "^8.3.2"
}
}
Loading