Skip to content

Instantly share code, notes, and snippets.


nparsons08/backend-message.js Secret

Created Nov 11, 2019
What would you like to do?
// backend/src/controllers/v1/message.js
const respondToUser = async (data) => {
const userId = data['user']['id'];
const eThree = await getEThree();
const publicKey = await eThree.lookupPublicKeys(userId);
const channel ='team', `${userId}-chatbot`, {});
const result = await interpretMessage(eThree, publicKey, data);
const response = await handleMessage(userId, result);
const encryptedText = await eThree.encrypt(response, publicKey);
const message = {
text: encryptedText,
user: { id: 'chatbot' },
await channel.sendMessage(message);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.