├── .gitignore
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── agent.zip
├── firebase.json
├── functions
├── .eslintrc.json
├── .gitignore
├── config.js
├── gdg.js
├── index.js
├── locales
│ ├── de.json
│ ├── en.json
│ ├── es.json
│ ├── it.json
│ ├── ja.json
│ ├── pt.json
│ └── tr.json
└── package.json
└── resources.md
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | package-lock.json
3 | *.DS_Store
4 | *.log
5 | .firebaserc
6 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # How to become a contributor and submit your own code
2 |
3 | ## Contributor License Agreements
4 |
5 | We'd love to accept your sample apps and patches! Before we can take them, we
6 | have to jump a couple of legal hurdles.
7 |
8 | Please fill out either the individual or corporate Contributor License Agreement
9 | (CLA).
10 |
11 | * If you are an individual writing original source code and you're sure you
12 | own the intellectual property, then you'll need to sign an [individual CLA](https://developers.google.com/open-source/cla/individual).
13 | * If you work for a company that wants to allow you to contribute your work,
14 | then you'll need to sign a [corporate CLA](https://developers.google.com/open-source/cla/corporate).
15 |
16 | Follow either of the two links above to access the appropriate CLA and
17 | instructions for how to sign and return it. Once we receive it, we'll be able to
18 | accept your pull requests.
19 |
20 | ## Contributing A Patch
21 |
22 | 1. Sign the Contributor License Agreement (see details above).
23 | 1. Fork the desired repo, develop and test your code changes.
24 | 1. Ensure that your code adheres to the existing style in the sample to which
25 | you are contributing. Refer to the
26 | [Google Cloud Platform Samples Style Guide](https://github.com/GoogleCloudPlatform/Template/wiki/style.html) for the
27 | recommended coding standards for this organization.
28 | 1. Ensure that your code has an appropriate set of unit tests which all pass.
29 | 1. Submit a pull request.
30 |
31 |
32 | # Translation
33 | We are looking to translate this Action into all available languages. You can contribute to this project by adding any of the languages missing from [available languages](https://developers.google.com/actions/localization/languages-locales). Currently the Action is available in the following languages:
34 |
35 | - English
36 | - German
37 | - Japanese
38 | - Spanish
39 | - Portuguese
40 | - Italian
41 | - Turkish
42 |
43 | ### GDG Action Translation Template Sheet
44 | [Here](https://docs.google.com/spreadsheets/d/1Tq5aauE1thrVLJjmdm9WetHZ0k0c-OrgGSt1CV6plxE/edit?usp=sharing) is all the verbiage used in this project.
45 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction, and
10 | distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by the copyright
13 | owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all other entities
16 | that control, are controlled by, or are under common control with that entity.
17 | For the purposes of this definition, "control" means (i) the power, direct or
18 | indirect, to cause the direction or management of such entity, whether by
19 | contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
20 | outstanding shares, or (iii) beneficial ownership of such entity.
21 |
22 | "You" (or "Your") shall mean an individual or Legal Entity exercising
23 | permissions granted by this License.
24 |
25 | "Source" form shall mean the preferred form for making modifications, including
26 | but not limited to software source code, documentation source, and configuration
27 | files.
28 |
29 | "Object" form shall mean any form resulting from mechanical transformation or
30 | translation of a Source form, including but not limited to compiled object code,
31 | generated documentation, and conversions to other media types.
32 |
33 | "Work" shall mean the work of authorship, whether in Source or Object form, made
34 | available under the License, as indicated by a copyright notice that is included
35 | in or attached to the work (an example is provided in the Appendix below).
36 |
37 | "Derivative Works" shall mean any work, whether in Source or Object form, that
38 | is based on (or derived from) the Work and for which the editorial revisions,
39 | annotations, elaborations, or other modifications represent, as a whole, an
40 | original work of authorship. For the purposes of this License, Derivative Works
41 | shall not include works that remain separable from, or merely link (or bind by
42 | name) to the interfaces of, the Work and Derivative Works thereof.
43 |
44 | "Contribution" shall mean any work of authorship, including the original version
45 | of the Work and any modifications or additions to that Work or Derivative Works
46 | thereof, that is intentionally submitted to Licensor for inclusion in the Work
47 | by the copyright owner or by an individual or Legal Entity authorized to submit
48 | on behalf of the copyright owner. For the purposes of this definition,
49 | "submitted" means any form of electronic, verbal, or written communication sent
50 | to the Licensor or its representatives, including but not limited to
51 | communication on electronic mailing lists, source code control systems, and
52 | issue tracking systems that are managed by, or on behalf of, the Licensor for
53 | the purpose of discussing and improving the Work, but excluding communication
54 | that is conspicuously marked or otherwise designated in writing by the copyright
55 | owner as "Not a Contribution."
56 |
57 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
58 | of whom a Contribution has been received by Licensor and subsequently
59 | incorporated within the Work.
60 |
61 | 2. Grant of Copyright License.
62 |
63 | Subject to the terms and conditions of this License, each Contributor hereby
64 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
65 | irrevocable copyright license to reproduce, prepare Derivative Works of,
66 | publicly display, publicly perform, sublicense, and distribute the Work and such
67 | Derivative Works in Source or Object form.
68 |
69 | 3. Grant of Patent License.
70 |
71 | Subject to the terms and conditions of this License, each Contributor hereby
72 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
73 | irrevocable (except as stated in this section) patent license to make, have
74 | made, use, offer to sell, sell, import, and otherwise transfer the Work, where
75 | such license applies only to those patent claims licensable by such Contributor
76 | that are necessarily infringed by their Contribution(s) alone or by combination
77 | of their Contribution(s) with the Work to which such Contribution(s) was
78 | submitted. If You institute patent litigation against any entity (including a
79 | cross-claim or counterclaim in a lawsuit) alleging that the Work or a
80 | Contribution incorporated within the Work constitutes direct or contributory
81 | patent infringement, then any patent licenses granted to You under this License
82 | for that Work shall terminate as of the date such litigation is filed.
83 |
84 | 4. Redistribution.
85 |
86 | You may reproduce and distribute copies of the Work or Derivative Works thereof
87 | in any medium, with or without modifications, and in Source or Object form,
88 | provided that You meet the following conditions:
89 |
90 | You must give any other recipients of the Work or Derivative Works a copy of
91 | this License; and
92 | You must cause any modified files to carry prominent notices stating that You
93 | changed the files; and
94 | You must retain, in the Source form of any Derivative Works that You distribute,
95 | all copyright, patent, trademark, and attribution notices from the Source form
96 | of the Work, excluding those notices that do not pertain to any part of the
97 | Derivative Works; and
98 | If the Work includes a "NOTICE" text file as part of its distribution, then any
99 | Derivative Works that You distribute must include a readable copy of the
100 | attribution notices contained within such NOTICE file, excluding those notices
101 | that do not pertain to any part of the Derivative Works, in at least one of the
102 | following places: within a NOTICE text file distributed as part of the
103 | Derivative Works; within the Source form or documentation, if provided along
104 | with the Derivative Works; or, within a display generated by the Derivative
105 | Works, if and wherever such third-party notices normally appear. The contents of
106 | the NOTICE file are for informational purposes only and do not modify the
107 | License. You may add Your own attribution notices within Derivative Works that
108 | You distribute, alongside or as an addendum to the NOTICE text from the Work,
109 | provided that such additional attribution notices cannot be construed as
110 | modifying the License.
111 | You may add Your own copyright statement to Your modifications and may provide
112 | additional or different license terms and conditions for use, reproduction, or
113 | distribution of Your modifications, or for any such Derivative Works as a whole,
114 | provided Your use, reproduction, and distribution of the Work otherwise complies
115 | with the conditions stated in this License.
116 |
117 | 5. Submission of Contributions.
118 |
119 | Unless You explicitly state otherwise, any Contribution intentionally submitted
120 | for inclusion in the Work by You to the Licensor shall be under the terms and
121 | conditions of this License, without any additional terms or conditions.
122 | Notwithstanding the above, nothing herein shall supersede or modify the terms of
123 | any separate license agreement you may have executed with Licensor regarding
124 | such Contributions.
125 |
126 | 6. Trademarks.
127 |
128 | This License does not grant permission to use the trade names, trademarks,
129 | service marks, or product names of the Licensor, except as required for
130 | reasonable and customary use in describing the origin of the Work and
131 | reproducing the content of the NOTICE file.
132 |
133 | 7. Disclaimer of Warranty.
134 |
135 | Unless required by applicable law or agreed to in writing, Licensor provides the
136 | Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
137 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
138 | including, without limitation, any warranties or conditions of TITLE,
139 | NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
140 | solely responsible for determining the appropriateness of using or
141 | redistributing the Work and assume any risks associated with Your exercise of
142 | permissions under this License.
143 |
144 | 8. Limitation of Liability.
145 |
146 | In no event and under no legal theory, whether in tort (including negligence),
147 | contract, or otherwise, unless required by applicable law (such as deliberate
148 | and grossly negligent acts) or agreed to in writing, shall any Contributor be
149 | liable to You for damages, including any direct, indirect, special, incidental,
150 | or consequential damages of any character arising as a result of this License or
151 | out of the use or inability to use the Work (including but not limited to
152 | damages for loss of goodwill, work stoppage, computer failure or malfunction, or
153 | any and all other commercial damages or losses), even if such Contributor has
154 | been advised of the possibility of such damages.
155 |
156 | 9. Accepting Warranty or Additional Liability.
157 |
158 | While redistributing the Work or Derivative Works thereof, You may choose to
159 | offer, and charge a fee for, acceptance of support, warranty, indemnity, or
160 | other liability obligations and/or rights consistent with this License. However,
161 | in accepting such obligations, You may act only on Your own behalf and on Your
162 | sole responsibility, not on behalf of any other Contributor, and only if You
163 | agree to indemnify, defend, and hold each Contributor harmless for any liability
164 | incurred by, or claims asserted against, such Contributor by reason of your
165 | accepting any such warranty or additional liability.
166 |
167 | END OF TERMS AND CONDITIONS
168 |
169 | APPENDIX: How to apply the Apache License to your work
170 |
171 | To apply the Apache License to your work, attach the following boilerplate
172 | notice, with the fields enclosed by brackets "[]" replaced with your own
173 | identifying information. (Don't include the brackets!) The text should be
174 | enclosed in the appropriate comment syntax for the file format. We also
175 | recommend that a file or class name and description of purpose be included on
176 | the same "printed page" as the copyright notice for easier identification within
177 | third-party archives.
178 |
179 | Copyright [yyyy] [name of copyright owner]
180 |
181 | Licensed under the Apache License, Version 2.0 (the "License");
182 | you may not use this file except in compliance with the License.
183 | You may obtain a copy of the License at
184 |
185 | http://www.apache.org/licenses/LICENSE-2.0
186 |
187 | Unless required by applicable law or agreed to in writing, software
188 | distributed under the License is distributed on an "AS IS" BASIS,
189 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190 | See the License for the specific language governing permissions and
191 | limitations under the License.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Actions on Google: GDG Sample
2 |
3 | *:warning: Warning: Conversational Actions will be deprecated on June 13, 2023. For more information,
4 | see [Conversational Actions Sunset](https://goo.gle/ca-sunset).*
5 |
6 | This sample demonstrates Actions on Google features for use on Google Assistant including localization ([i18n-node](https://github.com/mashpie/i18n-node)), conversation design, rich responses, and API integrations ([Cloud Translation API](https://cloud.google.com/translate/docs/) and [Meetup API](https://www.meetup.com/meetup_api/)) -- using the [Node.js client library](https://github.com/actions-on-google/actions-on-google-nodejs) and deployed on [Cloud Functions for Firebase](https://firebase.google.com/docs/functions/). Generally, this Action provides information about [Google Developer Groups](https://developers.google.com/groups).
7 |
8 | The [i18n-node](https://github.com/mashpie/i18n-node) library helps provide responses in several languages, which are contained in the `functions/locales` directory. Also, [Cloud Translation API](https://cloud.google.com/translate/docs/) translates data from Meetup API when the user's language does not match the GDG's primary language.
9 |
10 | :warning: This code sample was built using Dialogflow. We now recommend using [Actions Builder or the Actions SDK](https://developers.google.com/assistant/conversational/overview) to develop, test, and deploy Conversational Actions.
11 |
12 | **Attention: GDG Organizers**
13 | This sample can be published on the Google Assistant platform (instructions below).
14 |
15 | ### Enable Billing
16 | **Required for running this sample**
17 |
18 | Cloud Translation API as well as Meetup API use will both require billing enabled in the Cloud Platform Console. For more info on Cloud Translation API, you can visit [Pricing Infomation](https://cloud.google.com/translate#translation-api-pricing). This sample uses Firebase Cloud Functions to make an HTTP request to a non-Google service(Meetup API), which will require an upgrade to a Firebase plan that allows for outbound networking, such as the [Blaze Plan](https://firebase.google.com/pricing/), also called Pay as you go.
19 |
20 | ## Setup Instructions
21 | ### Prerequisites
22 | 1. Node.js and NPM
23 | + We recommend installing using [NVM](https://github.com/creationix/nvm)
24 | 1. Install the [Firebase CLI](https://developers.google.com/assistant/actions/dialogflow/deploy-fulfillment)
25 | + We recommend using version 6.5.0, `npm install -g firebase-tools@6.5.0`
26 | + Run `firebase login` with your Google account
27 |
28 | ### Configuration
29 | #### Actions Console
30 | 1. From the [Actions on Google Console](https://console.actions.google.com/?inviteCode=gdgaction), New project > **Create project** > under **More options** > **Conversational**
31 | 1. From the top menu under **Develop** > **Actions** (left nav) > **Add your first action** > **BUILD** (this will bring you to the Dialogflow console) > Select language and time zone > **CREATE**.
32 | 1. In the Dialogflow console, go to **Settings** ⚙ > **Export and Import** > **Restore from zip** using the `agent.zip` in this sample's directory.
33 |
34 | #### Cloud Platform Console
35 | 1. In the [Google Cloud Platform console](https://console.cloud.google.com/), select your *Project ID* from the dropdown
36 | 1. From **Menu ☰** > **APIs & Services** > **Library** > select **Cloud Translation API** > **Enable**
37 |
38 | #### Firebase Deployment
39 | 1. The following values need to be configured in the `functions/config.js` file:
40 | + `projectId`: Your Project ID
41 | + `gdgId`: unique identifier for the GDG on Meetup (ex: `google-developer-group-san-francisco` for `https://www.meetup.com/google-developer-group-san-francisco/`)
42 | + `gdgName`: short name for the GDG (ex: `GDG San Francisco`)
43 | + `appLocal`: language code from https://developers.google.com/assistant/console/languages-locales (ex: `en`, `pt`, `ja`, `es`, `tr`)
44 | 1. On your local machine, in the `functions` directory, run `npm install`
45 | 1. Run `firebase deploy --project {PROJECT_ID}` to deploy the function
46 | + To find your **Project ID**: In [Dialogflow console](https://console.dialogflow.com/) under **Settings** ⚙ > **General** tab > **Project ID**.
47 |
48 | #### Dialogflow Console
49 | 1. Return to the [Dialogflow Console](https://console.dialogflow.com) > select **Fulfillment** > **Enable** Webhook > Set **URL** to the **Function URL** that was returned after the deploy command > **SAVE**.
50 | ```
51 | Function URL (dialogflowFirebaseFulfillment): https://${REGION}-${PROJECT_ID}.cloudfunctions.net/dialogflowFirebaseFulfillment
52 | ```
53 | 1. From the left navigation menu, click **Integrations** > **Integration Settings** under Google Assistant > Enable **Auto-preview changes** > **Test** to open the Actions on Google simulator then say or type `Talk to my test app`.
54 |
55 | ### Running this Sample
56 | + You can test your Action on any Google Assistant-enabled device on which the Assistant is signed into the same account used to create this project. Just say or type, “OK Google, talk to my test app”.
57 | + You can also use the Actions on Google Console simulator to test most features and preview on-device behavior.
58 |
59 | ### Publish your Action on Google Assistant
60 | 1. In the [Actions on Google Console](https://console.actions.google.com) > from the top menu **Develop** > **Invocation** (left nav) > add in a **Display name** for each language. For ex: GDG San Francisco)
61 | + Disregard any messaging about matching to the invocation, since we'll add that later; if it does not save, add empty space at the end.
62 | 1. From the top menu **Deploy** > **Directory information** (left nav) and enter all the required information for **each** language > **SAVE**.
63 | + **Description** Suggested Directory information for descriptions [here](resources.md) for all languages
64 | + **Images**: Follow the [GDG Naming and Logo Guides](https://developers.google.com/programs/community/gdg/resources/)
65 | + **Privacy and Consent**: This Action does not save any user data. Make sure that you have this verbiage in every language contained in the same document.
66 | 1. Under **Deploy** > **Release** > **SUBMIT FOR PRODUCTION**.
67 |
68 | ### References & Issues
69 | + Questions? Go to [StackOverflow](https://stackoverflow.com/questions/tagged/actions-on-google), [Assistant Developer Community on Reddit](https://www.reddit.com/r/GoogleAssistantDev/) or [Support](https://developers.google.com/assistant/support).
70 | + For bugs, please report an issue on Github.
71 | + Actions on Google [Webhook Boilerplate Template](https://github.com/actions-on-google/dialogflow-webhook-boilerplate-nodejs).
72 | + [Codelabs](https://codelabs.developers.google.com/?cat=Assistant) for Actions on Google.
73 | + Actions on Google [Documentation](https://developers.google.com/assistant).
74 | + More info on deploying with [Firebase](https://developers.google.com/assistant/actions/dialogflow/deploy-fulfillment).
75 |
76 | ## Make Contributions
77 | Please read and follow the steps in the [CONTRIBUTING.md](CONTRIBUTING.md).
78 | We are looking to translate this Action into all available languages.
79 |
80 | ## License
81 | See [LICENSE](LICENSE).
82 |
83 | ## Terms
84 | Your use of this sample is subject to, and by using or downloading the sample files you agree to comply with, the [Google APIs Terms of Service](https://developers.google.com/terms/).
85 |
--------------------------------------------------------------------------------
/agent.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/actions-on-google/dialogflow-gdg-nodejs/3043230febe6ed58aadaafb95e56c2d23c00ef95/agent.zip
--------------------------------------------------------------------------------
/firebase.json:
--------------------------------------------------------------------------------
1 | {
2 | "functions": {
3 | "source": "functions",
4 | "predeploy": [
5 | "npm --prefix \"$RESOURCE_DIR\" run lint"
6 | ]
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/functions/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "parserOptions": {
3 | "ecmaVersion": 8,
4 | "sourceType": "script"
5 | },
6 | "extends": ["google"],
7 | "env": {
8 | "node": true
9 | },
10 | "rules": {
11 | "valid-jsdoc": 0,
12 | "require-jsdoc": 0
13 | }
14 | }
--------------------------------------------------------------------------------
/functions/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | package-lock.json
--------------------------------------------------------------------------------
/functions/config.js:
--------------------------------------------------------------------------------
1 | // Copyright 2018, Google, Inc.
2 | // Licensed under the Apache License, Version 2.0 (the 'License');
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an 'AS IS' BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | // meetup information
15 | const gdgId = '';// TODO: add GDG id from meetup (you can find it in the url)
16 | const gdgName = '';// TODO: add the GDG name (ie. GDG San Francisco)
17 |
18 | // meetup primary language, add the two character language code from
19 | // https://developers.google.com/actions/localization/languages-locales
20 | const appLocal = '';// TODO: add the two character language code (ie. 'en')
21 |
22 | // Your Actions on Google Project ID
23 | const projectId = '';// TODO: add the project id
24 |
25 | exports.gdgId = gdgId;
26 | exports.gdgName = gdgName;
27 | exports.appLocal = appLocal;
28 | exports.projectId = projectId;
29 |
--------------------------------------------------------------------------------
/functions/gdg.js:
--------------------------------------------------------------------------------
1 | // Copyright 2018, Google, Inc.
2 | // Licensed under the Apache License, Version 2.0 (the 'License');
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an 'AS IS' BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | // Import the Meetup API client
15 | const meetup = require('meetup-api')();
16 |
17 | /**
18 | * Class defining a Google Developer Group
19 | */
20 | class Gdg {
21 | constructor(gdgId) {
22 | this.gdgId = gdgId;
23 | }
24 |
25 | /**
26 | * Retrieves group info using the Meetup API.
27 | * @private
28 | */
29 | _getGroupInfo() {
30 | return new Promise((resolve, reject) => {
31 | // `https://api.meetup.com/${gdgId}`
32 | meetup.getGroup({
33 | urlname: this.gdgId,
34 | }, (err, resp) => {
35 | if (err) {
36 | reject(err);
37 | } else {
38 | this.info = resp;
39 | resolve(resp);
40 | }
41 | });
42 | });
43 | }
44 |
45 | /**
46 | * Retrieves details for an event.
47 | * @private
48 | */
49 | getEvent(eventId) {
50 | return new Promise((resolve, reject) => {
51 | // `https://api.meetup.com/${gdgId}/events/${eventId}`
52 | meetup.getEvent({
53 | urlname: this.gdgId,
54 | id: eventId,
55 | }, (err, resp) => {
56 | if (err) {
57 | console.log('getEvent - err: ' + err);
58 | reject(err);
59 | } else {
60 | resolve(resp);
61 | }
62 | });
63 | });
64 | }
65 |
66 | getMembers() {
67 | return this._getGroupInfo().then((info) => info.members);
68 | }
69 |
70 | getDescription() {
71 | return this._getGroupInfo().then((info) => info.description);
72 | }
73 |
74 | getNextEvent() {
75 | return this._getGroupInfo().then((info) => {
76 | if (!info.next_event) {
77 | return null;
78 | }
79 |
80 | return this.getEvent(info.next_event.id);
81 | });
82 | }
83 |
84 | getLastEvent() {
85 | return this.getLastEventId().then((eventId) => {
86 | if (!eventId) {
87 | return null;
88 | }
89 |
90 | return this.getEvent(eventId);
91 | });
92 | }
93 |
94 | /**
95 | * Retrieves id of the last event organized by this GDG.
96 | * @private
97 | */
98 | getLastEventId() {
99 | if (this.lastEventId !== undefined) {
100 | return Promise.resolve(this.lastEventId);
101 | }
102 |
103 | return this._getGroupInfo().then((info) => {
104 | return new Promise((resolve, reject) => {
105 | // `https://api.meetup.com/2/events`
106 | meetup.getEvents({
107 | group_urlname: this.gdgId,
108 | status: 'past',
109 | desc: 'true',
110 | page: 1,
111 | }, (err, resp) => {
112 | if (err) {
113 | console.log('getLastEventId - err: ' + err);
114 | reject(err);
115 | } else {
116 | if (resp && resp.results && resp.results[0]) {
117 | this.lastEventId = resp.results[0].id;
118 | resolve(resp.results[0].id);
119 | } else {
120 | resolve(null);
121 | }
122 | }
123 | });
124 | });
125 | });
126 | }
127 | }
128 |
129 | module.exports = {
130 | Gdg,
131 | };
132 |
--------------------------------------------------------------------------------
/functions/index.js:
--------------------------------------------------------------------------------
1 | // Copyright 2018, Google, Inc.
2 | // Licensed under the Apache License, Version 2.0 (the 'License');
3 | // you may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at
5 | //
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | //
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an 'AS IS' BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | 'use strict';
15 |
16 | // Import the dialogflow module from the client library.
17 | const {
18 | dialogflow,
19 | BasicCard,
20 | Button,
21 | Suggestions,
22 | SimpleResponse,
23 | } = require('actions-on-google');
24 |
25 | const config = require('./config');
26 |
27 | const path = require('path');
28 |
29 | // Class defining a Google Developer Group
30 | const Gdg = require('./gdg').Gdg;
31 |
32 | // Import the firebase-functions object from the Firebase Function npm module.
33 | const functions = require('firebase-functions');
34 |
35 | // Module to sanitize HTML and strip unwanted HTML tags
36 | const sanitizeHtml = require('sanitize-html');
37 |
38 | // Modules needed for localization
39 | const i18n = require('i18n');
40 | const moment = require('moment');
41 |
42 | i18n.configure({
43 | directory: path.join(__dirname, '/locales'),
44 | objectNotation: true,
45 | fallbacks: {
46 | 'it-IT': 'it',
47 | 'es-419': 'es',
48 | 'es-ES': 'es',
49 | 'es-MX': 'es',
50 | 'es-PE': 'es',
51 | 'de-DE': 'de',
52 | 'pt-BR': 'pt',
53 | 'ja-JP': 'ja',
54 | 'tr-TR': 'tr',
55 | },
56 | });
57 |
58 | // Imports the Google Cloud client library
59 | const Translate = require('@google-cloud/translate');
60 |
61 | // Instantiates a client
62 | const translate = new Translate.Translate({
63 | projectId: config.projectId,
64 | });
65 |
66 | // Instantiate the Dialogflow client. Returns an instance of DialogflowApp.
67 | const app = dialogflow({debug: true});
68 |
69 | const speakPrefix = ' ';
70 | const speakSuffix = ' ';
71 |
72 | /** Handles the welcome intent. */
73 | app.intent('Default Welcome Intent', (conv) => {
74 | // sets up the intent fullfillment tracking that matches to the
75 | // menu options, 0 is unfulfilled, 1 is fulfilled. This allows
76 | // suggestion chips to be customized to this conversation.
77 | conv.localize();
78 | conv.data.intentFullfilled = [0, 0, 0, 0, 0];
79 | if (conv.user.last.seen) {
80 | let messageText = i18n.__('WELCOME_BACK_TEXT', config.gdgName);
81 | let messageSpeech = speakPrefix +
82 | i18n.__('WELCOME_BACK_SPEECH', config.gdgName) + speakSuffix;
83 | conv.ask(new SimpleResponse({
84 | 'speech': messageSpeech,
85 | 'text': messageText,
86 | }));
87 | setLastPrompt(conv, messageText);
88 | } else {
89 | let messageText = i18n.__('WELCOME_NEW_TEXT', config.gdgName);
90 | let messageSpeech = speakPrefix +
91 | i18n.__('WELCOME_NEW_SPEECH', config.gdgName) + speakSuffix;
92 | conv.ask(new SimpleResponse({
93 | 'speech': messageSpeech,
94 | 'text': messageText,
95 | }));
96 | setLastPrompt(conv, messageText);
97 | }
98 | conv.ask(new Suggestions(selectSuggestionChips(conv)));
99 | });
100 |
101 | /** Handles the Dialogflow intent named 'event' */
102 | app.intent('event', (conv) => {
103 | conv.localize();
104 | clearFallbackNoinput(conv);
105 | let messageText = i18n.__('EVENT');
106 | setLastPrompt(conv, messageText);
107 | conv.ask(
108 | speakPrefix + messageText + speakSuffix,
109 | // Selects the "next" and "last" event suggestion chips
110 | new Suggestions([i18n.__('SUGGESTIONS.MENU')[1],
111 | i18n.__('SUGGESTIONS.MENU')[2]]));
112 | });
113 |
114 | /**
115 | * Handles the Dialogflow intent named 'next event'.
116 | * Uses async function to accommodate potential Translation API call.
117 | */
118 | app.intent('next event', async (conv) => {
119 | const gdg = new Gdg(conv.data.gdgId);
120 | const event = await gdg.getNextEvent();
121 | conv.localize();
122 | recordIntentAndClearErrorCount(conv, 'next event');
123 | if (!event) {
124 | let messageText = i18n.__('NO_UPCOMING_EVENT');
125 | conv.ask(speakPrefix + messageText + speakSuffix);
126 | setLastPrompt(conv, messageText);
127 | } else {
128 | let eventDate = moment(event.local_date).format('LL');
129 | // if the user's locale is different the project
130 | // will translate the meetup content
131 | let userLocale = conv.user.locale.slice(0, 2);
132 | if (userLocale != config.appLocal) {
133 | event.name = await translator(event.name, userLocale);
134 | eventDate = await translator(eventDate, userLocale);
135 | conv.localize();
136 | }
137 | let messageText = i18n.__('NEXT_EVENT', {
138 | name: event.name,
139 | date: eventDate,
140 | });
141 | conv.ask(messageText);
142 | setLastPrompt(conv, messageText);
143 | if (conv.screen) {
144 | conv.ask(new BasicCard({
145 | text: event.name,
146 | buttons: new Button({
147 | title: event.name,
148 | url: event.link,
149 | }),
150 | }));
151 | }
152 | }
153 | conv.ask(
154 | getSingleRandom(i18n.__('ANYTHING_ELSE')),
155 | new Suggestions(selectSuggestionChips(conv))
156 | );
157 | });
158 |
159 | /**
160 | * Handles the Dialogflow intent named 'next event'.
161 | * Uses async function to accommodate potential Translation API call.
162 | */
163 | app.intent('last event', async (conv) => {
164 | const gdg = new Gdg(conv.data.gdgId);
165 | const event = await gdg.getLastEvent();
166 | conv.localize();
167 | recordIntentAndClearErrorCount(conv, 'last event');
168 | if (!event) {
169 | let messageText = i18n.__('NO_UPCOMING_EVENT');
170 | conv.ask(speakPrefix + messageText + speakSuffix);
171 | setLastPrompt(conv, messageText);
172 | } else {
173 | let eventDate = moment(event.local_date).format('LL');
174 | // if the user's locale is different the project
175 | // will translate the meetup content
176 | let userLocale = conv.user.locale.slice(0, 2);
177 | if (userLocale != config.appLocal) {
178 | event.name = await translator(event.name, userLocale);
179 | eventDate = await translator(eventDate, userLocale);
180 | conv.localize();
181 | }
182 | let messageText = i18n.__('LAST_EVENT', {
183 | name: event.name,
184 | date: eventDate,
185 | });
186 | conv.ask(messageText);
187 | setLastPrompt(conv, messageText);
188 | if (conv.screen) {
189 | conv.ask(new BasicCard({
190 | text: event.name,
191 | buttons: new Button({
192 | title: event.name,
193 | url: event.link,
194 | }),
195 | }));
196 | }
197 | }
198 | conv.ask(
199 | getSingleRandom(i18n.__('ANYTHING_ELSE')),
200 | new Suggestions(selectSuggestionChips(conv))
201 | );
202 | });
203 |
204 | /** Handles the Dialogflow intent named 'members'. */
205 | app.intent('members', (conv) =>
206 | new Gdg(conv.data.gdgId).getMembers().then((members) => {
207 | conv.localize();
208 | recordIntentAndClearErrorCount(conv, 'members');
209 | let messageText = i18n.__('NUMBER_OF_MEMBERS', members);
210 | setLastPrompt(conv, messageText);
211 | conv.ask(
212 | speakPrefix + messageText + speakSuffix,
213 | getSingleRandom(i18n.__('ANYTHING_ELSE')),
214 | new Suggestions(selectSuggestionChips(conv))
215 | );
216 | })
217 | );
218 |
219 | /**
220 | * Handles the Dialogflow intent named 'next event'.
221 | * Uses async function to accommodate potential Translation API call.
222 | */
223 | app.intent('gdg', async (conv) => {
224 | const gdg = new Gdg(conv.data.gdgId);
225 | // Developer Note: Check your meetup description to make sure
226 | // it makes sense!
227 | const description = await gdg.getDescription();
228 | conv.localize();
229 | recordIntentAndClearErrorCount(conv, 'gdg');
230 | // Description is HTML-formatted, let's strip all tags
231 | const sanitizedDescription = sanitizeHtml(description, {
232 | allowedTags: [],
233 | allowedAttributes: [],
234 | });
235 | let messageText = sanitizedDescription;
236 | // if the user's locale is different the project
237 | // will translate the meetup content
238 | let userLocale = conv.user.locale.slice(0, 2);
239 | if (userLocale != config.appLocal) {
240 | messageText = await translator(sanitizedDescription, userLocale);
241 | }
242 | conv.ask(messageText);
243 | setLastPrompt(conv, messageText);
244 | conv.ask(
245 | getSingleRandom(i18n.__('ANYTHING_ELSE')),
246 | new Suggestions(selectSuggestionChips(conv))
247 | );
248 | });
249 |
250 | /** Handles the Dialogflow intent named 'help' */
251 | app.intent('help', (conv) => {
252 | conv.localize();
253 | recordIntentAndClearErrorCount(conv, 'help');
254 | let messageText = i18n.__('HELP');
255 | conv.ask(
256 | speakPrefix + messageText + speakSuffix,
257 | new Suggestions(selectSuggestionChips(conv))
258 | );
259 | setLastPrompt(conv, messageText);
260 | });
261 |
262 | /** Handles the Dialogflow intent named 'no input' */
263 | app.intent('no input', (conv) => {
264 | conv.localize();
265 | const repromptCount = parseInt(conv.arguments.get('REPROMPT_COUNT'));
266 | if (repromptCount === 0) {
267 | let messageText = i18n.__('REPROMPT_1');
268 | conv.ask(messageText);
269 | setLastPrompt(conv, messageText);
270 | } else if (repromptCount === 1) {
271 | let messageText = i18n.__('REPROMPT_2');
272 | conv.ask(
273 | messageText,
274 | new Suggestions(selectSuggestionChips(conv))
275 | );
276 | setLastPrompt(conv, messageText);
277 | } else if (conv.arguments.get('IS_FINAL_REPROMPT')) {
278 | conv.close(i18n.__('REPROMPT_FINAL'));
279 | }
280 | });
281 |
282 | /** Handles the Dialogflow intent named 'Default Fallback Intent' */
283 | app.intent('Default Fallback Intent', (conv) => {
284 | conv.localize();
285 | if (!conv.data.fallbackCount) {
286 | conv.data.fallbackCount = 0;
287 | }
288 | conv.data.fallbackCount++;
289 | if (conv.data.fallbackCount === 1) {
290 | let messageText = i18n.__('FALLBACKPROMPT_1');
291 | setLastPrompt(conv, messageText);
292 | conv.ask(
293 | messageText,
294 | new Suggestions(selectSuggestionChips(conv))
295 | );
296 | } else if (conv.data.fallbackCount === 2) {
297 | let messageText = i18n.__('FALLBACKPROMPT_2_TEXT');
298 | let messageSpeech = speakPrefix +
299 | i18n.__('FALLBACKPROMPT_2_SPEECH') + speakSuffix;
300 | conv.ask(
301 | new SimpleResponse({
302 | 'speech': messageSpeech,
303 | 'text': messageText,
304 | }),
305 | new Suggestions(selectSuggestionChips(conv))
306 | );
307 | setLastPrompt(conv, messageText);
308 | } else {
309 | conv.data.fallbackCount = 0;
310 | let messageText = i18n.__('FALLBACKPROMPT_FINAL');
311 | conv.close(messageText);
312 | }
313 | });
314 |
315 | /** Handles the Dialogflow intent named 'repeat' */
316 | app.intent('repeat', (conv) => {
317 | conv.localize();
318 | if (conv.data.lastPrompt) {
319 | let messageText = getSingleRandom(i18n.__('REPEAT_PREFIX')) +
320 | conv.data.lastPrompt;
321 | conv.ask(messageText);
322 | } else {
323 | let messageText =i18n.__('WELCOME_BASIC', config.gdgName);
324 | conv.ask(messageText);
325 | }
326 | conv.ask(new Suggestions(selectSuggestionChips(conv)));
327 | });
328 |
329 | /** Handles the Dialogflow intent named 'end' */
330 | app.intent('end', (conv) => {
331 | conv.localize();
332 | let messageText = getSingleRandom(i18n.__('FAREWELL'));
333 | conv.close(messageText);
334 | });
335 |
336 |
337 | app.middleware((conv) => {
338 | // Keep an instance of the Gdg class in the conversation data
339 | conv.data.gdgId = config.gdgId;
340 |
341 | conv.localize = () => {
342 | i18n.setLocale(conv.user.locale);
343 | moment.locale(conv.user.locale);
344 | };
345 | });
346 |
347 | /** Returns a single random element from some array */
348 | const getSingleRandom = (arr) => arr[Math.floor(Math.random() * arr.length)];
349 |
350 | /**
351 | * Sets the last prompt message
352 | * @param {obj} conv, the conversation object.
353 | * @param {str} message, the message.
354 | * @return {null} none.
355 | */
356 | function setLastPrompt(conv, message) {
357 | conv.data.lastPrompt = message;
358 | return null;
359 | }
360 |
361 |
362 | /**
363 | * Clears fallback and Noput attribut on conv
364 | * @param {obj} conv, the conversation object.
365 | * @return {null} none.
366 | */
367 | function clearFallbackNoinput(conv) {
368 | conv.data.fallbackCount = null;
369 | conv.data.noInput = null;
370 | return null;
371 | }
372 |
373 |
374 | /**
375 | * Converstaional maintiance, where it clears
376 | * the error counter and records that that
377 | * particular intent has been selected.
378 | * @param {obj} conv, the conversation object.
379 | * @param num conv, the conversation object.
380 | * @return {null} none.
381 | */
382 | function recordIntentAndClearErrorCount(conv, intentName) {
383 | clearFallbackNoinput(conv);
384 | recordsIntentFulfillment(conv, intentName);
385 | return null;
386 | }
387 |
388 |
389 | /**
390 | * Records which options the user has complete
391 | * @param {obj} conv, the conversation object.
392 | * @param num conv, the conversation object.
393 | * @return {null} none.
394 | */
395 | function recordsIntentFulfillment(conv, intentName) {
396 | const convertIntentValue = {
397 | 'gdg': 0,
398 | 'next event': 1,
399 | 'last event': 2,
400 | 'members': 3,
401 | };
402 |
403 | conv.data.intentFullfilled[convertIntentValue[intentName]] = 1;
404 | return null;
405 | }
406 |
407 | /**
408 | * Selects suggestion chips
409 | * @param {obj} conv, the conversation object.
410 | * @return [] array of suggestion chips.
411 | */
412 | function selectSuggestionChips(conv) {
413 | let suggestions = [];
414 | for (let i=0; i < conv.data.intentFullfilled.length; i++) {
415 | if (conv.data.intentFullfilled[i] === 0) {
416 | suggestions.push(i18n.__('SUGGESTIONS.MENU')[i]);
417 | }
418 | if (suggestions.length === 2) {
419 | return suggestions;
420 | }
421 | }
422 | return suggestions;
423 | }
424 |
425 | /**
426 | * Translates text for locale
427 | * @param {str} text, the string to translate.
428 | * @param {str} locale, the two letter locale code.
429 | * @return {str} the translated string.
430 | */
431 | const translator = async (text, locale) => {
432 | const results = await translate.translate(text, locale);
433 | const translation = results[0];
434 | return translation;
435 | };
436 |
437 |
438 | // Set app as a Handlesr for incoming HTTPS requests.
439 | exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);
440 |
--------------------------------------------------------------------------------
/functions/locales/de.json:
--------------------------------------------------------------------------------
1 | {
2 | "WELCOME_NEW_TEXT": "Willkommen bei der %s. Ich kann dir mehr über unsere Community erzählen, wie viele Mitglieder wir haben oder über unsere Events. Was möchtest du gerne wissen?",
3 | "WELCOME_NEW_SPEECH": "Willkommen bei der %s. Ich kann dir mehr über unsere Community erzählen, wie viele Mitglieder wir haben oder über unsere Events. Was möchtest du gerne wissen?",
4 | "WELCOME_BACK_TEXT": "Willkommen zurück! Ich kann dir mehr über unsere Community erzählen, wie viele Mitglieder wir haben oder über vergangene und geplante Events. Was davon möchtest du gerne wissen?",
5 | "WELCOME_BACK_SPEECH": "Willkommen zurück! Ich kann dir mehr über unsere Community erzählen, wie viele Mitglieder wir haben oder über vergangene und geplante Events. Was davon möchtest du gerne wissen?",
6 | "NUMBER_OF_MEMBERS": "Die GDG hat %s Mitglieder.",
7 | "NO_UPCOMING_EVENT": "Es ist kein Event geplant.",
8 | "EVENT": "Ich kann dir mehr über das letzte Event erzählen, oder über das nächste Event. Worüber möchtest du mehr hören?",
9 | "NEXT_EVENT": "Das nächste Event heißt {{{name}}} und findet am {{date}} statt.",
10 | "NO_LAST_EVENT": "Es gibt keine vergangenen Events.",
11 | "LAST_EVENT": "Das letzte Event war am {{date}} und hieß {{{name}}}.",
12 | "SUGGESTIONS": {
13 | "MENU": [
14 | "Über die GDG",
15 | "Das nächste Event",
16 | "Das letzte Event",
17 | "Anzahl der Mitglieder",
18 | "Tschüss"
19 | ]
20 | },
21 | "REPROMPT_1": "Tut mir Leid, das habe ich nicht verstanden. Ich kann dir mehr über die GDG erzählen oder über unser nächstes Event.",
22 | "REPROMPT_2": "Tut mir Leid, das habe ich nicht verstanden. Ich kann dir mehr über die GDG erzählen oder über unser nächstes Event. Wenn du fertig bist, sag einfach 'Tschüss'.",
23 | "IS_FINAL_REPROMPT": "Tut mir Leid, ich habe Schwierigkeiten. Lass uns für jetzt aufhören. Bis zum nächsten Mal.",
24 | "FALLBACKPROMPT_1": "Tut mir Leid, ich habe das nicht richtig verstanden. Ich kann dir mehr über die GDG erzählen oder über unser nächstes Event.",
25 | "FALLBACKPROMPT_2_TEXT": "Tut mir Leid, ich habe das nicht richtig verstanden. Ich kann dir mehr über die GDG erzählen oder über unser nächstes Event. Wenn du fertig bist, sag einfach 'Tschüss'.",
26 | "FALLBACKPROMPT_2_SPEECH" : "Tut mir Leid, ich habe das immer noch nicht richtig verstanden. Ich kann dir mehr über die GDG erzählen oder über unser nächstes Event. Wenn du fertig bist, sag einfach 'Tschüss'.",
27 | "FALLBACKPROMPT_FINAL": "Tut mir Leid, ich habe Schwierigkeiten. Lass uns für jetzt aufhören. Bis zum nächsten Mal.",
28 | "ANYTHING_ELSE": [
29 | " Wie kann ich dir sonst weiterhelfen?",
30 | " Gibt es noch etwas anderes, bei dem ich weiterhelfen kann?"
31 | ],
32 | "FAREWELL": [
33 | "Wir sehen uns beim nächsten Event!",
34 | "Danke fürs Vorbeischauen, bis bald!"
35 | ],
36 | "REPEAT_PREFIX": [
37 | "Sicher, ich habe gesagt, ",
38 | "Kein Problem, ",
39 | "Ich habe gesagt, "
40 | ],
41 | "HELP": "Ich kann dir mehr über die GDG, die Anzahl unserer Mitglieder oder über unsere Events erzählen. Worüber möchtest du mehr hören?"
42 | }
--------------------------------------------------------------------------------
/functions/locales/en.json:
--------------------------------------------------------------------------------
1 | {
2 | "WELCOME_NEW_TEXT": "Welcome to %s. I can tell you about the organization, how many members we have, or about events. What would you like to know?",
3 | "WELCOME_NEW_SPEECH": "Welcome to %s. I can tell you about the organization, how many members we have, or about events. What would you like to know.",
4 | "WELCOME_BACK_TEXT": "Welcome back! I can tell you about the organization, the number of members, or about past and future events. Which would you like?",
5 | "WELCOME_BACK_SPEECH": "Welcome back! I can tell you about the organization, the number of members, or about past and future events. Which would you like.",
6 | "NUMBER_OF_MEMBERS": "The GDG has %s members.",
7 | "NO_UPCOMING_EVENT": "There's no upcoming event planned.",
8 | "EVENT": " I can tell you about the last event, or the next one. Which one would you like?",
9 | "NEXT_EVENT": "The next event is called {{{name}}} and is on {{date}}.",
10 | "NO_LAST_EVENT": "There were no events in the past.",
11 | "LAST_EVENT": "The last event was on {{date}} and it was called {{{name}}}.",
12 | "SUGGESTIONS": {
13 | "MENU": [
14 | "About GDG",
15 | "Next event",
16 | "Last event",
17 | "# of Members",
18 | "Bye"
19 | ]
20 | },
21 | "REPROMPT_1": "Sorry, I didn't hear anything. I can tell you about the GDG or when our next event is.",
22 | "REPROMPT_2": "Sorry, I still didn't hear anything. I can tell you about the GDG or when our next event is, or if you're finished just say 'goodbye'.",
23 | "IS_FINAL_REPROMPT": "I'm sorry I'm having trouble. Let's stop here for now. Goodbye.",
24 | "FALLBACKPROMPT_1": "Sorry, I didn't quite get that. I can tell you about the GDG, or when our next event is.",
25 | "FALLBACKPROMPT_2_TEXT": "Sorry, I still didn't get that. I can tell you about the GDG or when our next event is, or if you're finished just say 'goodbye'.",
26 | "FALLBACKPROMPT_2_SPEECH" : "Sorry, I still didn't get that. I can tell you about the GDG, or when our next event is. Or, if you're finished just say 'goodbye'.",
27 | "FALLBACKPROMPT_FINAL": "I'm sorry I'm having trouble. Let's stop here for now. Goodbye.",
28 | "ANYTHING_ELSE": [
29 | " Now, what else can I help you with?",
30 | " Is there anything else I can help you with?"
31 | ],
32 | "FAREWELL": [
33 | "See you at our next meetup!",
34 | "Thanks for hanging out, talk to you soon!"
35 | ],
36 | "REPEAT_PREFIX": [
37 | "Sure, I said ",
38 | "No problem, ",
39 | "I said "
40 | ],
41 | "HELP": "I can tell you about the GDG, the number of members we have, or about events. Which would you like?"
42 | }
--------------------------------------------------------------------------------
/functions/locales/es.json:
--------------------------------------------------------------------------------
1 | {
2 | "WELCOME_NEW_TEXT": "Bienvenidos a %s. Puedo contarte sobre la organización, cuántos miembros tenemos, o sobre eventos. ¿Qué te gustaría saber?",
3 | "WELCOME_NEW_SPEECH": "Bienvenidos a %s. Puedo contarte sobre la organización, cuántos miembros tenemos, o sobre eventos. ¿Qué te gustaría saber?",
4 | "WELCOME_BACK_TEXT": "¡Hola de nuevo! Puedo contarte sobre el GDG, cuántos miembros tenemos, o sobre eventos. ¿Qué te gustaría saber?",
5 | "WELCOME_BACK_SPEECH": "¡Hola de nuevo! Puedo contarte sobre el GDG, cuántos miembros tenemos, o sobre eventos. ¿Qué te gustaría saber?",
6 | "NUMBER_OF_MEMBERS": "El GDG tiene %s miembros.",
7 | "NO_UPCOMING_EVENT": "No hay eventos planeados.",
8 | "EVENT": " Puedo contarte sobre el último evento o el siguiente. ¿Cuál te gustaría?",
9 | "NEXT_EVENT": "El próximo evento se llama {{{name}}} y es en {{date}}.",
10 | "NO_LAST_EVENT": "No hubo eventos en el pasado.",
11 | "LAST_EVENT": "El último evento fue el {{date}} y se llamó {{{name}}}.",
12 | "SUGGESTIONS": {
13 | "MENU": [
14 | "Sobre GDG",
15 | "Próximo evento",
16 | "Último evento",
17 | "Cuántos miembros",
18 | "Adiós"
19 | ]
20 | },
21 | "REPROMPT_1": "Lo siento, no escuché nada. Puedo contarte sobre el GDG o cuándo será nuestro próximo evento.",
22 | "REPROMPT_2": "Lo siento, todavía no escuché nada. Puedo informarle sobre el GDG o cuándo será nuestro próximo evento, o si acaba de decir simplemente 'adiós'.",
23 | "IS_FINAL_REPROMPT": "Lamento tener problemas. Vamos a detenernos aquí por ahora. Adiós.",
24 | "FALLBACKPROMPT_1": "Lo siento, no lo entendí del todo. Puedo contarte sobre el GDG, o cuándo será nuestro próximo evento.",
25 | "FALLBACKPROMPT_2": "Lo siento, todavía no entendí eso. Puedo informarle sobre el GDG o cuándo será nuestro próximo evento, o si acaba de decir simplemente 'adiós'.",
26 | "FALLBACKPROMPT_2_SPEECH" : "Lo siento, todavía no entendí eso. Puedo contarte sobre el GDG, o cuándo será nuestro próximo evento. O, si terminas, solo di 'adiós'.",
27 | "FALLBACKPROMPT_FINAL": "Lamento tener problemas. Vamos a detenernos aquí por ahora. Adiós.",
28 | "ANYTHING_ELSE": [
29 | "Ahora, ¿con qué más puedo ayudarte?",
30 | "¿Hay algo más con lo que pueda ayudarte?"
31 | ],
32 | "FAREWELL": [
33 | "¡Nos vemos en nuestra próxima reunión!",
34 | "Gracias por pasar el rato, hablamos pronto!"
35 | ],
36 | "REPEAT_PREFIX": [
37 | "Claro, dije ",
38 | "No hay problema, ",
39 | "Dije "
40 | ],
41 | "HELP": "Puedo informarle sobre el GDG, la cantidad de miembros que tenemos o sobre eventos. ¿Cual te gustaria?"
42 | }
--------------------------------------------------------------------------------
/functions/locales/it.json:
--------------------------------------------------------------------------------
1 | {
2 | "WELCOME_NEW_TEXT": "Benvenuto a %s. Posso darti informazioni riguardo al GDG, il numero dei suoi membri o gli eventi. Cosa vuoi sapere?",
3 | "WELCOME_NEW_SPEECH": "Benvenuto a %s. Posso darti informazioni riguardo al GDG, il numero dei suoi membri o gli eventi. Cosa vuoi sapere?",
4 | "WELCOME_BACK_TEXT": "Bentornato! Posso darti informazioni riguardo al GDG, il numero dei suoi membri, eventi passati o futuri. Quale ti interessa?",
5 | "WELCOME_BACK_SPEECH": "Bentornato! Posso darti informazioni riguardo al GDG, il numero dei suoi membri, eventi passati o futuri. Quale ti interessa?",
6 | "NUMBER_OF_MEMBERS": "Il GDG ha %s membri.",
7 | "NO_UPCOMING_EVENT": "Non ci sono eventi futuri in programma.",
8 | "EVENT": " Posso parlarti dell'ultimo evento o del prossimo.",
9 | "NEXT_EVENT": "Il prossimo evento si chiama {{{name}}} ed e' il {{date}}.",
10 | "NO_LAST_EVENT": "Non c'e' stato alcun evento in passato.",
11 | "LAST_EVENT": "L'ultimo evento e' stato il {{date}} e si chiamava {{{name}}}.",
12 | "SUGGESTIONS": {
13 | "MENU": [
14 | "GDG",
15 | "Prossimo evento",
16 | "Ultimo evento",
17 | "Numero di membri",
18 | "Arrivederci"
19 | ]
20 | },
21 | "REPROMPT_1": "Scusa, non ti ho sentito. Posso darti informazioni riguardo al GDG o il prossimo evento.",
22 | "REPROMPT_2": "Scusa, continuo a non sentire nulla. Posso darti informazioni riguardo al GDG o il prossimo evento. Se hai finito, basta che dici 'arrivederci'.",
23 | "IS_FINAL_REPROMPT": " Scusa, sto avendo dei problemi. Fermiamoci qua per adesso. A presto.",
24 | "FALLBACKPROMPT_1": "Scusa, non ho capito. Posso darti informazioni riguardo al GDG o il prossimo evento.",
25 | "FALLBACKPROMPT_2_TEXT": "Scusa, continuo a non capire. Posso darti informazioni riguardo al GDG o il prossimo evento. Se hai finito, basta che dici 'arrivederci'.",
26 | "FALLBACKPROMPT_2_SPEECH" : "Scusa, continuo a non capire. Posso darti informazioni riguardo al GDG. O il prossimo evento. Se hai finito, basta che dici 'arrivederci'.",
27 | "FALLBACKPROMPT_FINAL": "Scusa, sto avendo dei problemi. Fermiamoci qua per adesso. A presto.",
28 | "ANYTHING_ELSE": [
29 | " Posso aiutarti con qualcos'altro?",
30 | " Ti interessa qualche altra informazione?"
31 | ],
32 | "FAREWELL": [
33 | "Ci vediamo al prossimo evento!",
34 | "Grazie dell'attenzione, a presto!"
35 | ],
36 | "REPEAT_PREFIX": [
37 | "Certo, ho detto, ",
38 | "Nessun problema, ",
39 | "Ho detto "
40 | ],
41 | "HELP": "Posso parlarti del GDG, il numero di membri o gli eventi. Quale ti interessa?"
42 | }
--------------------------------------------------------------------------------
/functions/locales/ja.json:
--------------------------------------------------------------------------------
1 | {
2 | "WELCOME_NEW_TEXT": "%s にようこそ。私たちのコミュニティについて、人数やイベントなどをあなたにお伝えすることができます。知りたいことは何ですか?",
3 | "WELCOME_NEW_SPEECH": "%s にようこそ。私たちのコミュニティについて、人数やイベントなどをあなたにお伝えすることができます。知りたいことは何ですか?",
4 | "WELCOME_BACK_TEXT": "おかえりなさい!私たちのコミュニティについて、人数や、過去に行われたイベントや今後予定されているイベントに関する情報をあなたにお伝えすることができます。何がご希望でしょうか?",
5 | "WELCOME_BACK_SPEECH": "おかえりなさい!私は、私たちのコミュニティについて、人数や、過去に行われたイベントや今後予定されているイベントに関する情報をあなたにお伝えすることができます。何がご希望でしょうか?",
6 | "NUMBER_OF_MEMBERS": "GDGには、 %s 人のメンバーがいます。",
7 | "NO_UPCOMING_EVENT": "直近で予定されているイベントはありません。",
8 | "EVENT": "最後に行われたイベントや次のイベントについてお伝えすることができます。どちらがご希望でしょうか?",
9 | "NEXT_EVENT": "{{{name}}} というイベントが、 {{date}} に開催されます。",
10 | "NO_LAST_EVENT": "過去に行われたイベントはありません。",
11 | "LAST_EVENT": "最後に行われたイベントは、 {{{name}}} です。 {{date}} に行われました。",
12 | "SUGGESTIONS": {
13 | "MENU": [
14 | "GDGについて",
15 | "次のイベント",
16 | "最後に行われたイベント",
17 | "メンバー数",
18 | "さようなら"
19 | ]
20 | },
21 | "REPROMPT_1": "すみません、聞き取れませんでした。GDGについての情報や次のイベントの日付などについてお伝えすることができます。",
22 | "REPROMPT_2": "ごめんなさい、聞き取れませんでした。GDGについてやイベントの日付などについてお伝えすることができます。もし会話を終えたい場合は、'さようなら' とおっしゃってください。",
23 | "IS_FINAL_REPROMPT": "ごめんなさい、問題がありそうです。これで会話を終了します。また会いましょう。",
24 | "FALLBACKPROMPT_1": "すみません、よくわかりませんでした。GDGについての情報や次のイベントの日付などについてお伝えすることができます。",
25 | "FALLBACKPROMPT_2_TEXT": "ごめんなさい、よくわかりませんでした。GDGについてやイベントの日付などについてお伝えすることができます。もし会話を終えたい場合は、'さようなら'とおっしゃってください。",
26 | "FALLBACKPROMPT_2_SPEECH" : "ごめんなさい、よくわかりませんでした。GDGについてやイベントの日付などについてお伝えすることができます。また、会話を終えたい場合は、'さようなら'とおっしゃってください。",
27 | "FALLBACKPROMPT_FINAL": "ごめんなさい、問題がありそうです。これで会話を終了します。また会いましょう。",
28 | "ANYTHING_ELSE": [
29 | " さて、他に何かお手伝いできることはありますか?",
30 | " 何か他にお手伝いできることはありますでしょうか?"
31 | ],
32 | "FAREWELL": [
33 | "次のイベントでお会いしましょう!",
34 | "お立ち寄りいただきましてありがとうございます。またお話しましょう!"
35 | ],
36 | "REPEAT_PREFIX": [
37 | "はい、繰り返します。 ",
38 | "問題ありません。 ",
39 | "繰り返します。"
40 | ],
41 | "HELP": "GDEについて、人数やイベントなどの情報をあなたにお伝えすることができます。知りたいことは何ですか?"
42 | }
--------------------------------------------------------------------------------
/functions/locales/pt.json:
--------------------------------------------------------------------------------
1 | {
2 | "WELCOME_NEW_TEXT": "Bem-vindo ao %s. Posso te falar sobre a organização, quantos membros temos, ou sobre eventos. Sobre o que gostaria de saber?",
3 | "WELCOME_NEW_SPEECH": "Bem-vindo ao %s. Posso te falar sobre a organização, quantos membros temos, ou sobre eventos. Sobre o que gostaria de saber?",
4 | "WELCOME_BACK_TEXT": "Bem-vindo de volta! Posso te falar sobre a organização, número de membros, ou sobre eventos passados e futuros. Sobre qual você gostaria de saber?",
5 | "WELCOME_BACK_SPEECH": "Bem-vindo de volta! Posso te falar sobre a organização, número de membros, ou sobre eventos passados e futuros. Sobre qual você gostaria de saber?",
6 | "NUMBER_OF_MEMBERS": "O GDG tem %s membros.",
7 | "NO_UPCOMING_EVENT": "Não há eventos futuros planejados.",
8 | "EVENT": " Posso lhe falar sobre o últim o evento, ou o próximo. Qual dos dois você gostaria?",
9 | "NEXT_EVENT": "O próximo evento é o {{{name}}} e será em {{date}}.",
10 | "NO_LAST_EVENT": "Não há eventos anteriores.",
11 | "LAST_EVENT": "O último evento foi o {{{name}}} e aconteceu em {{date}}.",
12 | "SUGGESTIONS": {
13 | "MENU": [
14 | "Sobre o GDG",
15 | "Próximo evento",
16 | "Último evento",
17 | "Número de membros",
18 | "Até logo"
19 | ]
20 | },
21 | "REPROMPT_1": "Desculpe, não escutei nada. Posso lhe dizer sobre o GDG ou quando é nosso próximo evento.",
22 | "REPROMPT_2": "Desculpe, continuo não escutando. Posso lhe dizer sobre o GDG, quando é nosso próximo evento, ou se você estiver satisfeito, basta dizer 'tchau'.",
23 | "IS_FINAL_REPROMPT": "Desculpe, estou tendo problema. Vamos parar por aqui por enquanto. Até mais.",
24 | "FALLBACKPROMPT_1": "Desculpe, não entendi. Posso lhe falar sobre o GDG, ou quando é nosso próximo evento.",
25 | "FALLBACKPROMPT_2_TEXT": "Desculpe, eu ainda não entendi. Posso lhe falar sobre o GDG, sobre o nosso próximo evento, ouse você estiver satisfeito, basta dizer 'tchau'.",
26 | "FALLBACKPROMPT_2_SPEECH" : "Desculpe, eu ainda não entendi. Posso lhe falar sobre o GDG, sobre o nosso próximo evento, ouse você estiver satisfeito, basta dizer 'tchau'.",
27 | "FALLBACKPROMPT_FINAL": "Desculpe, estou tendo problema. Vamos parar por aqui por enquanto. Até mais.",
28 | "ANYTHING_ELSE": [
29 | " E agora, no que mais posso te ajudar?",
30 | " Tem mais alguma coisa em que posso te ajudar?"
31 | ],
32 | "FAREWELL": [
33 | "Vejo você no nosso próximo meetup!",
34 | "Obrigado pela conversa, nos falamos em breve!"
35 | ],
36 | "REPEAT_PREFIX": [
37 | "Claro, eu disse: ",
38 | "Sem problema, ",
39 | "Eu disse "
40 | ],
41 | "HELP": "Posso lhe falar sobre o GDG, o total de membros que temos, ou sobre nossos eventos. Sobre o que você quer saber?"
42 | }
--------------------------------------------------------------------------------
/functions/locales/tr.json:
--------------------------------------------------------------------------------
1 | {
2 | "WELCOME_NEW_TEXT": "%s'ya hoş geldiniz. Sana toplulukla ilgili bilgi verebilir, kaç kişi olduğumuzu söyleyebilir veya etkinliklerimizden bahsedebilirim. Ne bilmek istersin?",
3 | "WELCOME_NEW_SPEECH": "%s'ya hoş geldiniz. Sana toplulukla ilgili bilgi verebilir, kaç kişi olduğumuzu söyleyebilir veya etkinliklerimizden bahsedebilirim. Ne bilmek istersin.",
4 | "WELCOME_BACK_TEXT": "Tekrar hoşgeldin! Sana toplulukla ilgili bilgi verebilir, kaç kişi olduğumuzu söyleyebilir veya geçmiş ve gelecek etkinliklerimizden bahsedebilirim. Hangisini istersin?",
5 | "WELCOME_BACK_SPEECH": "Tekrar hoşgeldin! Sana toplulukla ilgili bilgi verebilir, kaç kişi olduğumuzu söyleyebilir veya geçmiş ve gelecek etkinliklerimizden bahsedebilirim. Hangisini istersin.",
6 | "NUMBER_OF_MEMBERS": "GDG'nin %s üyesi var.",
7 | "NO_UPCOMING_EVENT": "Yakın gelecekte planlanmış bir etkinliğimiz yok.",
8 | "EVENT": "Son düzenlediğimiz etkinlikten veya en yakın etkinliğimizden bahsedebilirim. Hangisini istersin?",
9 | "NEXT_EVENT": "Sıradaki etkinliğimiz, {{date}} tarihinde düzenleyeceğimiz {{{name}}}.",
10 | "NO_LAST_EVENT": "Hiç geçmiş etkinliğimiz yok.",
11 | "LAST_EVENT": "En son {{{name}}} etkinliğimizi {{date}} tarihinde düzenledik.",
12 | "SUGGESTIONS": {
13 | "MENU": [
14 | "GDG Hakkında",
15 | "Sıradaki Etkinlik",
16 | "Son Etkinlik",
17 | "Üye Sayısı",
18 | "Hoşça kal!"
19 | ]
20 | },
21 | "REPROMPT_1": "Üzgünüm, bir şey duyamadım. Sana GDG'den veya en yakın etkinliğimizden bahsedebilirim.",
22 | "REPROMPT_2": "Kusura bakma, yine bir şey duyamadım. Sana GDG'den veya en yakın etkinliğimizden bahsedebilirim ya da konuşmak istemiyorsan 'hoşça kal' diyebilirsin.",
23 | "IS_FINAL_REPROMPT": "Üzgünüm, bir sorun yaşıyorum. Şimdilik burada duralım. Görüşmek üzere.",
24 | "FALLBACKPROMPT_1": "Pardon, tam olarak anlamadım. Sana GDG'den veya en yakın etkinliğimizden bahsedebilirim.",
25 | "FALLBACKPROMPT_2_TEXT": "Üzgünüm, yine bir şey duyamadım. Sana GDG'den veya en yakın etkinliğimizden bahsedebilirim ya da konuşmak istemiyorsan 'hoşça kal' diyebilirsin.",
26 | "FALLBACKPROMPT_2_SPEECH" : "Üzgünüm, yine bir şey duyamadım. Sana GDG'den veya en yakın etkinliğimizden bahsedebilirim ya da konuşmak istemiyorsan 'hoşça kal' diyebilirsin.",
27 | "FALLBACKPROMPT_FINAL": "Üzgünüm, bir sorun yaşıyorum. Şimdilik burada duralım. Görüşmek üzere.",
28 | "ANYTHING_ELSE": [
29 | "Sana başka nasıl yardımcı olabilirim?",
30 | "Yardımcı olabileceğim başka bir konu var mı?"
31 | ],
32 | "FAREWELL": [
33 | "Sıradaki etkinliğimizde görüşmek üzere!",
34 | "Sohbetin için teşekkürler, görüşmek üzere!"
35 | ],
36 | "REPEAT_PREFIX": [
37 | "Tabi, dedim ki; ",
38 | "Tabi; ",
39 | "Dedim ki; "
40 | ],
41 | "HELP": "Sana GDG ile ilgili bilgi verebilir, kaç kişi olduğumuzu söyleyebilir veya etkinliklerimizden bahsedebilirim. Hangisini istersin?"
42 | }
43 |
--------------------------------------------------------------------------------
/functions/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "functions",
3 | "description": "Cloud Functions for Firebase",
4 | "scripts": {
5 | "lint": "eslint .",
6 | "serve": "firebase serve --only functions",
7 | "shell": "firebase functions:shell",
8 | "start": "npm run shell",
9 | "deploy": "firebase deploy --only functions",
10 | "logs": "firebase functions:log"
11 | },
12 | "engines": {
13 | "node": "8"
14 | },
15 | "dependencies": {
16 | "@google-cloud/translate": "^2.1.3",
17 | "actions-on-google": "^2.7.0",
18 | "firebase-admin": "^7.2.0",
19 | "firebase-functions": "^2.2.1",
20 | "html-entities": "^1.2.1",
21 | "i18n": "^0.8.3",
22 | "meetup-api": "^1.4.32",
23 | "moment": "^2.22.1",
24 | "sanitize-html": "1.18.2"
25 | },
26 | "devDependencies": {
27 | "eslint": "^4.12.0",
28 | "eslint-config-google": "^0.9.1"
29 | },
30 | "private": true
31 | }
32 |
--------------------------------------------------------------------------------
/resources.md:
--------------------------------------------------------------------------------
1 | # Resources
2 | Additional Resources
3 |
4 | ## Directory-Suggestion
5 |
6 | ### English | en
7 | Description: Learn about GDG San Francisco
8 | Full description: Learn about what GDG San Francisco is doing; from when the next event is to what they are all about.
9 |
10 | ### Italian | it
11 | Description: Scopri di più su GDG San Francisco
12 | Full description: Scopri cosa sta facendo GDG San Francisco; da quando il prossimo evento è a cosa si tratta.
13 |
14 | ### Spanish | es
15 | Description: Aprende sobre GDG San Francisco
16 | Full description: Aprenda sobre lo que está haciendo GDG San Francisco; desde cuando el próximo evento es de lo que se trata.
17 |
18 | ### German | de
19 | Description: Erfahren Sie mehr über GDG San Francisco
20 | Full description: Erfahren Sie, was GD San Francisco macht; ab wann das nächste Ereignis ist, worum es bei ihnen geht.
21 |
22 |
23 | ### Portuguese (Brazil) | pt
24 | Description: Saiba mais sobre o GDG San Francisco
25 | Full description: Saiba mais sobre o que o GDG San Francisco está fazendo; a partir de quando o próximo evento é sobre o que eles são. O GDG é o Grupo de desenvolvedores do Google.
26 |
27 | ### Japanese | ja
28 | Description: GDGサンフランシスコについて学ぶ
29 | Full description: GDGサンフランシスコの活動次のイベントが来たときから彼らが何をすべきかまで。
30 |
31 | ### Turkish | tr
32 | Description: GDG San Francisco hakkında bilgi edinin
33 | Full description: GDG San Francisco'nun ne yaptığını öğrenin; Bir sonraki olayın ne olduğu hakkında.
34 |
35 |
36 | ## Images
37 |
38 | Follow the [GDG Naming and Logo Guides](https://developers.google.com/programs/community/gdg/resources/)
--------------------------------------------------------------------------------