
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
blip-chat-extension
Advanced tools
* `npm install` * `npm start` * Project will be running on `http://localhost:3002`
npm install
npm start
http://localhost:3002
Control BLiP Chat's webview from your web page. You may need to have some control over BLiP Chat's webview once you have added it to your web page. This script extension allows you to that.
Simply install the blip-chat-extension package from the npm registry.
$ npm install blip-chat-extension
Now you just have to import the package and use it:
var blipCards = require("blip-chat-extension");
(function () {
window.onload = function () {
var WebView = new BlipChatExtension()
}
})();
To import the script just copy and paste the following code:
<script src="https://unpkg.com/blip-chat-extension@1.0.0" type="text/javascript">
</script>
<script>
(function () {
window.onload = function () {
var WebView = new BlipChatExtension()
}
})();
</script>
You should create an instance of BlipChatExtension
and operate on it.
You may need to close BLiP Chat's webview after an event or transaction has finished. To close the webview use the method closeWebView
from the instanced object.
var WebView = new BlipChatExtension()
WebView.closeWebView()
If the chatbot's conversation state has stopped and you need to update that state (after some interaction with your web page, for example) use the method sendMessage
to send a message to the chatbot.
var WebView = new BlipChatExtension()
// Sending a simple text message
WebView.sendMessage("My simple text message")
// Sending a media link message
WebView.sendMessage({
"type": "application/vnd.lime.media-link+json",
"content": {
"title": "My image message",
"text": "Here is a cat image for you!",
"type": "image/jpeg",
"uri":
"http://2.bp.blogspot.com/-pATX0YgNSFs/VP-82AQKcuI/AAAAAAAALSU/Vet9e7Qsjjw/s1600/Cat-hd-wallpapers.jpg",
"aspectRatio": "1:1",
"size": 227791,
"previewUri":
"https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcS8qkelB28RstsNxLi7gbrwCLsBVmobPjb5IrwKJSuqSnGX4IzX",
"previewType": "image/jpeg"
}
})
You can send any document supported on blip. To see more go to BLiP Help Center.
If you need to send a complex message, you can send an object with the properties payload
and preview
. They are used to specify what is sent to chatbot and what is shown to user respectively.
Should you need to send your location to the chatbot but only a simple text like I'm here
is to be shown to the user, you can do it as follows:
var WebView = new BlipChatExtension()
// Sending Location card to chatbot and showing a text message to user
WebView.sendMessage({
"payload": {
"type": "application/vnd.lime.location+json",
"content": {
"latitude": -19.918899,
"longitude": -43.959275,
"altitude": 853,
"text": "Take's place"
}
},
"preview": {
"type": "text/plain",
"content": "Im here"
}
})
Or maybe you have some content to be trafficked that the user should not see. For that you should send the object keeping the payload
but omitting the preview
property.
var WebView = new BlipChatExtension()
// Sending a message to the chatbot that the user will not see it's content
WebView.sendMessage({
"payload": {
"type": "text/plain",
"content": "Hidden content"
}
})
With the method overrideOnClose
you can, for example, guarantee that a form is submitted before the user closes the webview. The function to be executed when the user tries to close the webview is passed as a parameter to the method:
var WebView = new BlipChatExtension()
WebView.overrideOnClose(function () {
alert('Please complete the form before leaving')
return false // Prevent webview from closing
})
The overrideOnClose
method has a return that determines whether the webview should be closed or not . By returning true
the webview's closing method will proceed normally and by returning false
it will be blocked.
var WebView = new BlipChatExtension()
WebView.overrideOnClose(function () {
WebView.sendMessage('Webview will close')
return true // Webview will close
})
Methods | Description | Parameters |
---|---|---|
closeWebView | Close the webview | None |
sendMessage | Send a message to bot in name of the user | string or { preview: {}, payload: {} } |
overrideOnClose | Override webview's default close function | function |
FAQs
* `npm install` * `npm start` * Project will be running on `http://localhost:3002`
The npm package blip-chat-extension receives a total of 100 weekly downloads. As such, blip-chat-extension popularity was classified as not popular.
We found that blip-chat-extension demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.