Open Graph Plugin for Chat Engine
Identify if message.data.text contains an URL, send it to your server or a third party service and get the data collected into message.data.metadata which you can use in order to transform a plain message in a thumbnail.
Quick Start
npm install chat-engine-open-graph
- Have a ChatEngine server running already, instantiate a client and connect it
const ChatEngine = ChatEngineCore; ChatEngine;ChatEngine;
- Grab your API key from Opengraph.io . It should look a litte something like this:
const apiKey = "xxxxxxxxxxxxxxx";
- Attach this plugin to the channel you want, in this case global
You have to inject a function to the attribute api which receive as a parameter the URL detected inside of message and arrange it into a query parameter to the API endpoint of the server side.
ChatEngineglobal; or const opengraph = ; ChatEngineglobal;