chatfuel-api
Advanced tools
Comparing version 2.0.1 to 2.1.0
{ | ||
"name": "chatfuel-api", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "A library to simplify sending messages and broadcasts to a Chatfuel bot over Facebook Messenger", | ||
@@ -32,3 +32,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"axios": "^0.18.0" | ||
"axios": "^0.21.1" | ||
}, | ||
@@ -48,3 +48,3 @@ "devDependencies": { | ||
"lint-staged": "^7.2.0", | ||
"mocha": "^5.2.0", | ||
"mocha": "^9.0.1", | ||
"prettier": "^1.14.2", | ||
@@ -51,0 +51,0 @@ "sinon": "^6.1.5" |
@@ -1,2 +0,2 @@ | ||
# chatfuel-api | ||
# Chatfuel Messages and Broadcast API | ||
@@ -17,3 +17,3 @@ [![Build Status](https://travis-ci.org/eric-mathison/chatfuel-api.svg?branch=master)](https://travis-ci.org/eric-mathison/chatfuel-api) | ||
``` | ||
```bash | ||
npm install chatfuel-api | ||
@@ -24,3 +24,3 @@ ``` | ||
``` | ||
```js | ||
import { Chatfuel, broadcast } from 'chatfuel-api'; | ||
@@ -33,9 +33,9 @@ ``` | ||
```js | ||
new Chatfuel(); | ||
``` | ||
new Chatfuel() | ||
``` | ||
To render the complete JSON response, call the method | ||
``` | ||
```js | ||
.render(); | ||
@@ -48,3 +48,3 @@ ``` | ||
``` | ||
```js | ||
.addText('Your text here') | ||
@@ -56,3 +56,3 @@ .render() | ||
``` | ||
```js | ||
.addImage('URL of Image') | ||
@@ -64,3 +64,3 @@ .render() | ||
``` | ||
```js | ||
.addVideo('URL of Video') | ||
@@ -72,3 +72,3 @@ .render() | ||
``` | ||
```js | ||
.addAudio('URL of Audio File') | ||
@@ -80,3 +80,3 @@ .render() | ||
``` | ||
```js | ||
.addFile('URL of File') | ||
@@ -90,3 +90,3 @@ .render() | ||
``` | ||
```js | ||
.addButton('button type', 'attr', 'button title', extensions) | ||
@@ -107,3 +107,3 @@ .render('button'); | ||
``` | ||
```js | ||
.addButton('link', 'https://url.com', 'Link', true) | ||
@@ -119,3 +119,3 @@ .render('button') | ||
``` | ||
```js | ||
const buttons = new Chatfuel() | ||
@@ -127,5 +127,3 @@ .addButton('link', 'https://test.com/test', 'URL Button') | ||
const message = new Chatfuel() | ||
.addButtonBlock('Text', buttons) | ||
.render(); | ||
const message = new Chatfuel().addButtonBlock('Text', buttons).render(); | ||
``` | ||
@@ -137,3 +135,3 @@ | ||
``` | ||
```js | ||
const buttons = new Chatfuel() | ||
@@ -151,3 +149,3 @@ .addButton('link', 'https://link.com', 'Test Button') | ||
``` | ||
```js | ||
.addQuickReply(type, attr, 'Title') | ||
@@ -167,3 +165,3 @@ .render('qr') | ||
``` | ||
```js | ||
const qReplies = new Chatfuel() | ||
@@ -174,5 +172,3 @@ .addQuickReply('block', ['Block 1'], 'Yes') | ||
const textMessage = new Chatfuel() | ||
.addText('Testing Text Message', qReplies) | ||
.render(); | ||
const textMessage = new Chatfuel().addText('Testing Text Message', qReplies).render(); | ||
``` | ||
@@ -186,14 +182,12 @@ | ||
```js | ||
const message = new Chatfuel().addAttributes('attribute').render(); | ||
``` | ||
const message = new Chatfuel() | ||
.addAttributes('attribute') | ||
.render() | ||
``` | ||
Sending an attribute with a JSON Callback Button | ||
``` | ||
```js | ||
const message = new Chatfuel() | ||
.addAttributes('attribute', 'json', 'json button', 'https://callback.url') | ||
.render() | ||
.render(); | ||
``` | ||
@@ -203,11 +197,11 @@ | ||
``` | ||
```js | ||
const attributes = { | ||
attribute1: '1', | ||
attribute2: '2', | ||
} | ||
}; | ||
const message = new Chatfuel() | ||
.addAttributes(attributes, 'block', 'block button', ['Block Name']) | ||
.render() | ||
.render(); | ||
``` | ||
@@ -217,3 +211,3 @@ | ||
``` | ||
```js | ||
.addRedirect('block 1', 'block 2') | ||
@@ -229,3 +223,3 @@ .render() | ||
``` | ||
```js | ||
const options = { | ||
@@ -249,3 +243,3 @@ // required | ||
``` | ||
```js | ||
broadcast(options) | ||
@@ -264,3 +258,3 @@ .then(() => { | ||
``` | ||
```js | ||
const message = new Chatfuel() | ||
@@ -274,3 +268,3 @@ .addText('Test Text') | ||
``` | ||
```js | ||
const qReplies = new Chatfuel() | ||
@@ -294,3 +288,3 @@ .addQuickReply('json', 'https://test.com/test?a=yes', 'JSON Yes Button') | ||
``` | ||
```js | ||
const galleryArray = []; | ||
@@ -303,3 +297,3 @@ // define data | ||
``` | ||
```js | ||
const gallery = new Chatfuel(); | ||
@@ -306,0 +300,0 @@ for (let i = 0; i < galleryArray.length; ) { |
Sorry, the diff of this file is not supported yet
81598
44
1817
302
+ Addedaxios@0.21.4(transitive)
+ Addedfollow-redirects@1.15.6(transitive)
- Removedaxios@0.18.1(transitive)
- Removedfollow-redirects@1.5.10(transitive)
- Removedis-buffer@2.0.5(transitive)
Updatedaxios@^0.21.1