Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chat-engine-open-graph

Package Overview
Dependencies
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chat-engine-open-graph

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.

  • 0.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

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
  1. Have a ChatEngine server running already, instantiate a client and connect it

const ChatEngine = ChatEngineCore.create({
    publishKey: 'pub-key-here',
    subscribeKey: 'sub-key-here'
});


ChatEngine.connect('Username');
ChatEngine.on('$ready', () = { ... });
  1. Grab your API key from Opengraph.io . It should look a litte something like this:
const apiKey = "xxxxxxxxxxxxxxx";
  1. 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.

ChatEngine.global.plugin(ChatEngineCore.plugin['chat-engine-open-graph']({
  api: (url) => `https://opengraph.io/api/1.1/site/${encodeURI(url)}?app_id=${apiKey}`
}));

or

const opengraph = require('chat-engine-open-graph');

ChatEngine.global.plugin(opengraph({ api: (url) => `https://opengraph.io/api/1.1/site/${encodeURI(url)}?app_id=${apiKey}` }));

Keywords

FAQs

Package last updated on 17 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc