├── .all-contributorsrc ├── .gitignore ├── README.md ├── craco.config.js ├── jest.config.js ├── package-lock.json ├── package.json ├── public ├── appConfig.example.js └── appConfig.js ├── src ├── AgentAutoresponsePlugin.js ├── components │ ├── CannedResponses.Styles.jsx │ └── CannedResponses.jsx └── index.js ├── webpack.config.js └── webpack.dev.js /.all-contributorsrc: -------------------------------------------------------------------------------- 1 | { 2 | "files": [ 3 | "README.md" 4 | ], 5 | "imageSize": 100, 6 | "commit": false, 7 | "contributors": [ 8 | { 9 | "login": "ahcai", 10 | "name": "Alice Cai", 11 | "avatar_url": "https://avatars.githubusercontent.com/u/4912483?v=4", 12 | "profile": "https://github.com/ahcai", 13 | "contributions": [ 14 | "bug", 15 | "code", 16 | "doc", 17 | "design", 18 | "question" 19 | ] 20 | }, 21 | { 22 | "login": "ktalebian", 23 | "name": "Kousha Talebian", 24 | "avatar_url": "https://avatars.githubusercontent.com/u/2308915?v=4", 25 | "profile": "https://github.com/ktalebian", 26 | "contributions": [ 27 | "bug", 28 | "code", 29 | "doc", 30 | "design", 31 | "question" 32 | ] 33 | }, 34 | { 35 | "login": "johnfischelli", 36 | "name": "John Fischelli", 37 | "avatar_url": "https://avatars.githubusercontent.com/u/1213604?v=4", 38 | "profile": "https://github.com/johnfischelli", 39 | "contributions": [ 40 | "code", 41 | "doc", 42 | "design" 43 | ] 44 | } 45 | ], 46 | "contributorsPerLine": 7, 47 | "projectName": "plugin-agent-autoresponse", 48 | "projectOwner": "twilio-labs", 49 | "repoType": "github", 50 | "repoHost": "https://github.com", 51 | "skipCi": true 52 | } 53 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # next.js build output 61 | .next 62 | 63 | # Flex related ignore 64 | appConfig.js 65 | build/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Agent Auto-Response Plugin 2 | 3 | [](#contributors-) 4 | 5 | 6 | This Twilio Flex Plugin enables your agents to send canned responses when chatting with a customer. 7 | 8 | To learn more about developing plugins on your Flex instance, refer to the [getting started guide](https://www.twilio.com/docs/flex/quickstart/getting-started-plugin). 9 | 10 | --- 11 | 12 | There are two main files in this example: 13 | 14 | ``` 15 | src/AgentAutoResponsePlugin.js 16 | src/components/CannedResponses.js 17 | ``` 18 | 19 | The main file is the `AgentAutoResponsePlugin.js` file, and contains many comments describing how the auto-response example is achieved. In addition, it appends the Canned Responses component in `CannedResponses.js` to Chat/SMS conversations. 20 | 21 | While the canned-responses are static in this example, you might build on this example and call-out to your own server to retrieve your curated list of canned responses before rendering them in the Flex UI. 22 | 23 | --- 24 | 25 | When you run this plugin - you'll see a pre-defined message sent by the answering agent as soon as they accept the task. 26 | 27 | Additionally, you'll see new UI added below the Chat Input field which is a Select menu and will let you select from a list of pre-defined canned responses. When selecting any message in the select menu - it will automatically be sent into the chat/sms channel. 28 | 29 | ## Screenshot 30 | 31 |  32 | 33 | ## Setup 34 | 35 | Make sure you have [Node.js](https://nodejs.org) as well as [`npm`](https://npmjs.com) installed. 36 | 37 | Afterwards install the dependencies by running `npm install`: 38 | 39 | ```bash 40 | cd plugin-agent-autoresponse 41 | 42 | # If you use npm 43 | npm install 44 | ``` 45 | 46 | ## Development 47 | 48 | In order to develop locally, you can use the Webpack Dev Server by running: 49 | 50 | ```bash 51 | twilio flex:plugins:start 52 | ``` 53 | 54 | This will automatically start up the Webpack Dev Server and open the browser for you. Your app will run on `http://localhost:3000`. If you want to change that you can do this by setting the `PORT` environment variable: 55 | 56 | ```bash 57 | PORT=3001 twilio flex:plugins:start 58 | ``` 59 | 60 | When you make changes to your code, the browser window will be automatically refreshed. 61 | 62 | Type `twilio flex:plugins:start --help` to get more detailed information about the command. 63 | 64 | ## Deploy and Release Plugin 65 | 66 | When you are ready to deploy your plugin, in your terminal run: 67 | 68 | ```bash 69 | twilio flex:plugins:deploy --major --changelog "Adding Auto-Response for Agents" --description "Ability for agents to send canned responses" 70 | ``` 71 | 72 | This will upload your plugin to Flex. After a deploy, your plugin is not yet enabled for all your users on your Flex application. You need to run the release command after the deploy to enable any changes: 73 | 74 | ```bash 75 | twilio flex:plugins:release --name "Plugin Auto-Response" --description "Enabling plugin auto-response" --plugin plugin-agent-autoresponse@latest 76 | ``` 77 | 78 | For more details on deploying your plugin, refer to the [deploying your plugin guide](https://www.twilio.com/docs/flex/developer/plugins/cli/deploy-and-release). 79 | 80 | Note: Common packages like `React`, `ReactDOM`, `Redux` and `ReactRedux` are not bundled with the build because they are treated as external dependencies so the plugin will depend on Flex to provide them globally. 81 | 82 | ## Contributors ✨ 83 | 84 | Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): 85 | 86 | 87 | 88 | 89 |
Alice Cai 🐛 💻 📖 🎨 💬 |
92 | Kousha Talebian 🐛 💻 📖 🎨 💬 |
93 | John Fischelli 💻 📖 🎨 |
94 |