Commit bac0a99e authored by Prajval Raval's avatar Prajval Raval

code push

parent 1d0ba028
# alexa-rc-multiserver-client
# Rocket Chat Multi Server Skill
Rocket.Chat Alexa skill that works as client for multiple servers
## Hosting Proxy Server
1. Until we have UI ready on Rocket chat, You can test this skill by hosting [server](https://github.com/RocketChat/vui-multiservers-proxy) on Heroku or any hosting service of your choice.
2. After server is up and running you can use Postman or CURL as per your choice to send Servername, ServerURL, UserID and Token and get a pincode. To generate UserID and Token go to Rocket Chat => My Account => Personal Access Token. Header Syntax can be found [here](https://github.com/RocketChat/vui-multiservers-proxy#to-register-user)
## Deploying Skill
1. Clone the repository
`git clone https://github.com/RocketChat/alexa-rc-multiserver-client`
2. Go To Root Directory,
`cd alexa-rc-multiserver-client`
3. Deploy Skill,
`ask deploy`
## Creating Database
1. After deploying skill, goto [DynamoDB](https://console.aws.amazon.com/dynamodb/home?region=us-east-1) and click on Create Table
2. Give A Table name. For Primary Key use 'userID' as key name.
3. Click on Add sort key, and give 'server' as key name.
4. Click on Create
## Giving Lambda Environment Variables
1. Once the table is ready, go to your lambda function and give the following values:
**DDB_NAME** : Your DynamoDB Table Name
**MULTISERVERPROXY_URL** : Your Proxy Server URL
* Example Config:
![screen](https://user-images.githubusercontent.com/41849970/61810502-04f70580-ae5d-11e9-95b0-362b942f2965.png)
## Testing Skill
1. To Add a server say : **Alexa, Add Server** followed by pincode generated in the proxy server request.
2. To Switch a Server : **Alexa, Switch Server** followed by servername you provided.
3. Currently this skill supports only PostMessageIntent and GetLastMessageIntent. Also don't use keyword *Alexa* as a channelname or in utterances as it will not work.
# Channel
- **Create A New Channel**
English
```
Alexa, Create CHANNELNAME
```
Italian
```
Alexa, Crea CHANNELNAME
```
French
```
Alexa, Créer Une Chambre CHANNELNAME
```
German
```
Alexa, Raum Erstellen CHANNELNAME
```
Spainish
```
Alexa, Crear Canal CHANNELNAME
```
Portuguese
```
Alexa, Criar Canal CHANNELNAME
```
- **Delete A Channel**
English
```
Alexa, Delete CHANNELNAME
```
Italian
```
Alexa, Elimina CHANNELNAME
```
French
```
Alexa, Supprimer La Pièce CHANNELNAME
```
German
```
Alexa, Raum Löschen CHANNELNAME
```
Spainish
```
Alexa, Eliminar Canal CHANNELNAME
```
Portuguese
```
Alexa, Apagar Canal CHANNELNAME
```
- **Add All Users On Server To A Channel**
English
```
Alexa, Add All To CHANNELNAME
```
Italian
```
Alexa, Aggiungi Tutti A CHANNELNAME
```
French
```
Alexa, Tout Ajouter à CHANNELNAME
```
German
```
Alexa, Alles Zu CHANNELNAME hinzufügen
```
Spainish
```
Alexa, Agregar Todo A CHANNELNAME
```
Portuguese
```
Alexa, Adicionar Todos Ao CHANNELNAME
```
- **Make An User Channel Moderator**
English
```
Alexa, Make USERNAME Moderator Of CHANNELNAME
```
Italian
```
Alexa, Fai USERNAME Moderatore Di CHANNELNAME
```
French
```
Alexa, Make USERNAME Modérateur De CHANNELNAME
```
German
```
Alexa, Mach USERNAME Moderator Von CHANNELNAME
```
Spainish
```
Alexa, Crea USERNAME Moderador De CHANNELNAME
```
Portuguese
```
Alexa, Fazer USERNAME Moderador De CHANNELNAME
```
- **Make An User Channel Owner**
English
```
Alexa, Make USERNAME Owner Of CHANNELNAME
```
Italian
```
Alexa, Fai USERNAME Proprietario Di CHANNELNAME
```
French
```
Alexa, Make USERNAME Propriétaire De CHANNELNAME
```
German
```
Alexa, Mach USERNAME Besitzer Von CHANNELNAME
```
Spainish
```
Alexa, Crea USERNAME Propietario De CHANNELNAME
```
Portuguese
```
Alexa, Fazer USERNAME dono de CHANNELNAME
```
- **Archive A Channel**
English
```
Alexa, Archive CHANNELNAME
```
Italian
```
Alexa, Archivia CHANNELNAME
```
French
```
Alexa, Archive CHANNELNAME
```
German
```
Alexa, Archiv CHANNELNAME
```
Spainish
```
Alexa, Archivo CHANNELNAME
```
Portuguese
```
Alexa, Arquivar CHANNELNAME
```
- **Create A New Group**
English
```
Alexa, Create Private Channel CHANNELNAME
```
Portuguese
```
Alexa, Criar Canal Privado CHANNELNAME
```
- **Delete A Group**
English
```
Alexa, Delete Private Channel CHANNELNAME
```
Portuguese
```
Alexa, Excluir Canal Privado CHANNELNAME
```
- **Make An User Group Moderator**
English
```
Alexa, Make USERNAME Moderator Of Private Channel CHANNELNAME
```
Portuguese
```
Alexa, Tornar O USERNAME Moderador Do Canal Privado CHANNELNAME
```
- **Make An User Group Owner**
English
```
Alexa, Make USERNAME Owner Of Private Channel CHANNELNAME
```
Portuguese
```
Alexa, Tornar O USERNAME Proprietário Do Canal Privado CHANNELNAME
```
# Chat
- **Post A Message**
English
```
Alexa, Send MESSAGE to CHANNELNAME
Alexa, Send MESSAGE emoji EMOJI to CHANNELNAME
```
Italian
```
Alexa, Invia USERNAME In CHANNELNAME
```
French
```
Alexa, Envoyer MESSAGE à CHANNELNAME
```
German
```
Alexa, MESSAGE An CHANNELNAME Senden
```
Spainish
```
Alexa, Enviar MESSAGE a CHANNELNAME
```
Portuguese
```
Alexa, Mandar MESSAGE Para O CHANNELNAME
Alexa, Enviar MESSAGE Emoji EMOJINAME Para CHANNELNAME
```
- **Read Last Message From A Channel**
English
```
Alexa, Read CHANNELNAME last message
```
Italian
```
Alexa, Leggi l'Ultimo Messaggio In CHANNELNAME
```
French
```
Alexa, Lire Le Dernier Message De CHANNELNAME
```
German
```
Alexa, Letzte Nachricht Von CHANNELNAME Lesen
```
Spainish
```
Alexa, Leer El último Mensaje De CHANNELNAME
```
Portuguese
```
Alexa, Leia A última Mensagem Do CHANNELNAME
```
- **Read Unread Messages From A Channel**
English
```
Alexa, Read My Unread Messages From CHANNELNAME
```
Italian
```
Alexa, Leggi I Miei Messaggi Non Letti Da CHANNELNAME
```
Portuguese
```
Alexa, Leia Minhas Mensagens Não Lidas De CHANNELNAME
```
French
```
Alexa, Lire Mes Messages Non Lus De CHANNELNAME
```
German
```
Alexa, Lesen Sie Meine Ungelesenen Nachrichten Von CHANNELNAME
```
Spainish
```
Alexa, Leer Mis Mensajes No Leídos De CHANNELNAME
```
- **Post Message In A Private Channel**
English
```
Alexa,Send MESSAGE To Private Channel CHANNELNAME
```
Portuguese
```
Alexa,Enviar MESSAGE Para O Canal Privado CHANNELNAME
```
- **Post Emoji Message In A Private Channel**
English
```
Alexa,Send MESSAGE Emoji EMOJINAME to Private Channel CHANNELNAME
```
Portuguese
```
Alexa,Enviar MESSAGE Emoji EMOJINAME Para O Canal Privado CHANNELNAME
```
- **Read Last Message From A Private Channel**
English
```
Alexa,Read Last Message From Private Channel CHANNELNAME
```
Portuguese
```
Alexa,Leia A Última Mensagem Do Canal Privado CHANNELNAME
```
- **Read Unread Messages From A Private Channel**
English
```
Alexa,Read Unread Messages From Private Channel CHANNELNAME
```
Portuguese
```
Alexa,Leia Minhas Mensagens Não Lidas De Canal Privado CHANNELNAME
```
***
- **Change Notification Settings**
English
```
Alexa, Change my notification settings
```
# IM
- **Send DM To An User**
English
```
Alexa, Direct Message MESSAGE Recipient USERNAME
```
Portuguese
```
Alexa, Mensagem Direta MESSAGE Destinatário USERNAME
```
- **Send DM With Emoji To An User**
English
```
Alexa, Direct Message MESSAGE Emoji EMOJINAME Recipient USERNAME
```
Portuguese
```
Alexa, Mensagem Direta MESSAGE Emoji EMOJINAME Destinatário USERNAME
```
***
# User
- **Help Intent**
English
```
Alexa, Help
```
Portuguese
```
Alexa, Socorro
```
- **Stop Intent**
English
```
Alexa, Stop
```
Portuguese
```
Alexa, Pare
```
***
{
"extends": [
"@rocket.chat/eslint-config"
]
}
This diff is collapsed.
/* eslint-disable no-dupe-keys */
// const envVariables = require('./config');
// REST API Endpoints
module.exports = {
postmessageurl: '/api/v1/chat.postMessage',
channelmessageurl: '/api/v1/channels.messages?roomName=',
};
// Environment Variables
module.exports = {
proxyurl: process.env.MULTISERVERPROXY_URL,
dynamoDBTableName: process.env.DDB_NAME,
};
const axios = require('axios');
const apiEndpoints = require('./apiEndpoints');
const envVariables = require('./config');
const removeWhitespace = require('remove-whitespace');
const Jargon = require('@jargon/alexa-skill-sdk');
const {
ri,
} = Jargon;
// Server Credentials. Follow readme to set them up.
const {
proxyurl,
} = envVariables;
// Axios Functions
const getData = async (code) =>
await axios
.get(`${ proxyurl }/user/data?qcode=${ code }`)
.then((res) => res.data)
.then((res) => {
console.log(res);
return {
status: res.status,
userdata: {
serverurl: res.data.serverinfo.serverurl,
headers: res.data.headers,
},
servername: res.data.serverinfo.servername,
speech: ri('SERVER.SUCCESS'),
};
})
.catch((err) => {
console.log(err);
return {