![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
A simple library for constructing structured messages for the Messenger Platform Send API.
smsg
is a simple library for constructing structured messages (with attachments) for the Messenger Platform Send API.
smsg
is a shortening of the termstructured message
You can use smsg
to quickly build:
button template
attachmentsgeneric template
attachmentsimage
attachmentspostback
buttonsweb_url
buttonsInstalling smsg
is as simple as installing any other npm module:
$ npm install smsg --save
import smsg from 'smsg'
smsg.image('https://www.images.com/image-1.png')
Outputs the following message
object:
{
attachment: {
type: 'image',
payload: {
url: 'https://www.images.com/image-1.png'
}
}
}
import smsg from 'smsg'
smsg.button_template('What do you want?', [
smsg.postback('See Products', 'SEE_PRODUCTS'),
smsg.postback('Donate Money', 'DONATE'),
smsg.web_url('See Website', 'https://www.example.com')
])
Outputs the following message
object:
{
attachment: {
type: 'template',
payload: {
template_type: 'button',
text: 'What do you want?',
buttons: [
{
title: 'See Products',
type: 'postback',
payload: 'SEE_PRODUCTS'
},
{
title: 'Donate Money',
type: 'postback',
payload: 'DONATE'
},
{
title: 'See Website',
type: 'web_url',
url: 'https://www.example.com'
}
]
}
}
}
Builds a button template attachment.
smsg.button_template(text, buttons)
Parameter | Type | Description | Required |
---|---|---|---|
text | String | Text that appears in main body | Yes |
buttons | Array | Set of buttons that appear as call-to-actions | Yes |
Builds a generic template attachment.
smsg.generic_template(elements)
Parameter | Type | Description | Required |
---|---|---|---|
elements | Array | Data for each bubble in message | Yes |
Builds an image attachment.
smsg.image(url)
Parameter | Type | Description | Required |
---|---|---|---|
url | String | URL of image | Yes |
Builds a postback button.
smsg.postback(title, payload)
Parameter | Type | Description | Required |
---|---|---|---|
title | String | Button title | Yes |
payload | String | This data will be sent back to you via webhook | Yes |
Builds a web_url button (link).
smsg.web_url(title, url)
Parameter | Type | Description | Required |
---|---|---|---|
title | String | Button title | Yes |
url | String | This URL is opened in a browser when the button is tapped | Yes |
First, install dev dependencies. Then, run npm test
$ npm install
$ npm test
Something does not work as expected or perhaps you think this module needs a feature? Please open an issue using GitHub's issue tracker. Please be as specific and straightforward as possible.
Pull Requests (PRs) are welcome. Make sure you follow the same basic stylistic conventions as the original code (i.e. "JavaScript standard code style")
Copyright (c) 2016 Kristian Muñiz
FAQs
A simple library for constructing structured messages for the Messenger Platform Send API.
We found that smsg 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.