New Prague, Minnesota

    chatfuel

    1.2.2 • Public • Published

    Install

    npm install chatfuel

    Usage

    const chatfuel = require('chatfuel')

    API Reference

    API Reference


    Send Text

    messages.push(chatfuel.sendText({ text: 'Hello' }))
    messages.push(chatfuel.sendText({ text: 'Welcome to chatfuel' }))

    Send Image

    Messenger supports JPG, PNG and GIF images. If you are having issues with GIF rendering, please try to reduce the file size.

    const photo = 'http://ngaoduky.com/assets/img/ngaoduky.jpg'
    messages.push(chatfuel.sendImage({url:photo}))

    Send Video

    Messenger supports MP4 videos, which are up to 25MB in size.

    const video = 'http://ngaoduky.com/assets/img/ngaoduky.mp4'
    messages.push(chatfuel.sendVideo({url:video}))

    Send Audio

    Messenger supports MP3, OGG, WAV audios, which are up to 25MB in size

    const audio = 'http://ngaoduky.com/assets/img/ngaoduky.mp3'
    messages.push(chatfuel.sendAudio({url:audio}))

    Send File

    Files are no larger than 25 MB

    const file = 'http://ngaoduky.com/assets/img/ngaoduky.pdf'
    messages.push(chatfuel.sendAudio({url:file}))

    Send Galleries

    const title = 'Title of element'
    const image_url = 'http://ngaoduky.com/assets/img/ngaoduky.jpg'
    const subtitle = 'Size: M'
    buttons.push(chatfuel.createButtonToURL({ url: 'https://www.facebook.com/', title: 'Go to facebook' }))
    const element = chatfuel.createElement({ title, image_url, subtitle, buttons })
    const elements = []
    elements.push(element)
    elements.push(element)
    messages.push(chatfuel.sendGalleries({ elements }))

    Send List

    const title = 'Title of element'
    const image_url = 'http://ngaoduky.com/assets/img/ngaoduky.jpg'
    const subtitle = 'Size: M'
    buttons.push(chatfuel.createButtonToURL({ url: 'https://www.facebook.com/', title: 'Go to facebook' }))
    const element = chatfuel.createElement({ title, image_url, subtitle, buttons })
    const elements = []
    elements.push(element)
    elements.push(element)
    messages.push(chatfuel.sendLists({ elements }))

    Create Button To Block

    const title = 'SELECT ITEM'
    const block_names = ['SELECT_ITEM']
    const set_attributes = { item_id: '3' }
    const buttons = []
    buttons.push(chatfuel.createButtonToBlock({ title, block_names, set_attributes }))

    Create Button To URL

    const title = 'View My Blog'
    const url = 'http://ngaoduky.com/'
    const buttons = []
    buttons.push(chatfuel.createButtonToURL({ url, title }))

    Create Call Button

    const title = 'Call me maybe'
    const phone_number = '0989999999'
    buttons.push(chatfuel.createCallButton({ phone_number, title }))

    Create Postback Button

    const title = 'Back'
    const url = 'https://rockets.chatfuel.com/api/welcome'
    buttons.push(chatfuel.createPostBackButton({ url, title }))

    Create Quick Reply Button

    const title = 'Show menu'
    const block_names = ['MENU']
    buttons.push(chatfuel.createQuickReplyButton({ title, block_names }))

    Create Share Button

    buttons.push(chatfuel.createShareButton())

    Install

    npm i chatfuel

    DownloadsWeekly Downloads

    3

    Version

    1.2.2

    License

    ISC

    Unpacked Size

    6.93 kB

    Total Files

    5

    Last publish

    Collaborators

    • kinhdomcom