FM BetterForms
BF Editorfmbetterforms.com
1.0 dont use
1.0 dont use
  • Introduction
  • Features Summary
  • Getting Started
    • System Overview
    • Integration
      • 1. Configure FileMaker Server
      • 2. Add your Server to BetterForms
      • 3. Introduction to Hooks
      • 4. Create your first Site
      • 5. Create your first Page
      • 6. Configure your FileMaker File(s)
      • 7. Run your first Hook
      • Next Steps
    • Common Customizations
      • Introduction to Actions
      • Introduction to Buttons
      • Page Navigation
      • Displaying Data in a Table
    • Support
      • Hacking a Webpage
      • Learning JSON
  • Reference
    • Site Settings
      • Navigation
      • Slots / Code Injection
      • App Model
      • Site-wide Named Actions
    • Page Settings
      • Data Model
      • Card / Window Modals
      • Validation
        • Custom Validators
      • Misc Page Settings
    • Page Elements
      • Common
        • Button
        • Data Table
        • HTML
      • Grouping Elements
        • Tabs
        • panel
        • accordion
        • listrows
      • Uploading Files
        • dropzone
        • dropzone to S3
        • uploadCare
      • Misc Elements
        • Plain Text / Code Editor
        • signature
        • fullCalendar
        • rangeSlider
      • Payment Gateways
        • Authorize.net
        • PayPal
        • Stripe
      • Adding Custom Page Elements
    • Actions Processor
      • Named Actions
      • Actions
        • runUtilityHook
        • path
        • debounce
        • throttle
        • showAlert
        • showModal / hideModal
        • function
        • clipboard
        • cookie
        • setFocus
        • wait
        • emit
        • validate
        • channelJoinAnon
        • channelLeaveAnon
        • messageSend
        • messageSendAnonChannel
      • Authentication Actions
    • Script Hooks
      • Globals Variables
        • $$BF_Model
        • $$BF_App
        • $$BF_State
      • Keeping Keys Private
      • Reducing Payload Size
      • API Callback Endpoint
      • Common Hooks
      • Scoped Hooks
    • Users & Authentication
      • Managing User Accounts
      • Custom Login Pages
    • Advanced Configuration
      • Custom Domains
    • BF Utility Functions
    • BF Error Codes
    • Messaging
      • Adding users to channels
      • Removing users from channels
      • Sending messages
      • Get connected users
      • Get active channels
  • Usage Tips
    • Troubleshooting
      • Debugging
      • Frozen Actions Queue
    • JavaScript Tips
      • Calling Named Actions from HTML Vue Events
      • Calculations
    • System Overview
    • Forms Processor
      • Form Types
      • HTML & VueJS
      • Styling and Design
      • JS Caclulations and Functions
    • Customizing and Styling
      • Custom Components
      • Custom CSS
      • Custom Components
      • Page Pre-loaders
      • Favicon
    • Design Patterns and Best Practices
      • Working with environments
      • Handling Data
      • Saving Data
      • Optimization
      • Business Logic
      • UI / UX
  • Security
    • Authentication
    • Security White Paper
    • Firewalls
    • Technology Stack
  • Compatibility
Powered by GitBook
On this page
  • BF Action
  • Authenticated Channels
  • Anonymous channel
  • FileMaker Script
  • API endpoint /message/sendmessage
  • API: Send Message

Was this helpful?

  1. Reference
  2. Messaging

Sending messages

Once your users are subscribed to a channel or two, you can send messages to them!

PreviousRemoving users from channelsNextGet connected users

Last updated 3 years ago

Was this helpful?

Think of a message as a standard that is triggered externally. It can even contain data to populate the page, but you don't have to wait for a user to click a button, run a utility hook, or even poll your server for updates on a set interval.

BF Action

Authenticated Channels

The BF action messageSend can be used to send a message to channel or channels. It requires a channel key to be set under options.

Example

  • options.channel

// This will send a showAlert action
// to channels "channel1", "channel2" and "channel3"
[
  {
    "action": "messageSend",
    "options": {
      "actions": [
        {
          "action": "showAlert",
          "options": {
            "text": "Hello from Message",
            "title": "Hello World",
            "type": "information"
          }
        }
      ],
      "model": {
        "myModelData": "modelData"
      },
      "app": {
        "myAppData": "appModelData"
      },
      "channels": ["channel1", "channel2", "channel3"]
    }
  }
]

Full action reference:

Anonymous channel

The BF action messageSendAnonChannel can be used to send a message to channel or channels. It requires a channel key to be set under options.

Example

  • options.channel

// This will send a showAlert action
// to channels "channel1", "channel2" and "channel3"
[
  {
    "action": "messageSendAnonChannel",
    "options": {
      "actions": [
        {
          "action": "showAlert",
          "options": {
            "text": "Hello from Message",
            "title": "Hello World",
            "type": "information"
          }
        }
      ],
      "model": {
        "myModelData": "modelData"
      },
      "app": {
        "myAppData": "appModelData"
      },
      "channels": ["channel1", "channel2", "channel3"]
    }
  }
]

Full action reference:

FileMaker Script

The script is available in Helper file and is called API - Send Message. This script accepts an object with four keys message, channels, apiKey and domain.

  • message: it accepts an object with:

    • actions: array of BF action objects;

    • model: object with model data;

    • app: object with app model data.

  • channels: string of channel name or array of strings;

  • apiKey: API key from corresponding app;

  • domain: domain to send message to.

Example Parameter

{
  "message": {
    "actions": [
      {
        "action": "showAlert",
        "options": {
          "text": "Alert from FM",
          "title": "Hello World",
          "type": "information"
        }
      }
    ],
    "model": {
      "myModelData": "modelData"
    },
    "app": {
      "myAppData": "appModelData"
    }
  },
  "channels": ["channel1", "channel2"],
  "apiKey": "BFAPI_XXXX-YYYY-XXXX",
  "domain": "my.domain.com"
}

API endpoint /message/sendmessage

API: Send Message

POST https://yourdomain.com/message/sendmessage

Headers

Name
Type
Description

accept

string

application/json

content-type

string

application/json

Request Body

Name
Type
Description

apiKey

string

the API key for the corresponding app

channels

array

array of channel names

message

string

JSON object to be sent

message.actions

array

JSON for an array of BF action objects

message.model

object

JSON object with data to be merged to model data

message.app

array

JSON object with data to be merged to app model data

Example request body

{
  "message": {
    "actions": [
      {
        "action": "showAlert",
        "options": {
          "text": "Alert from Jhon",
          "title": "Hello World",
          "type": "information"
        }
      }
    ],
    "model": {
      "myModelData": "modelData"
    },
    "app": {
      "myAppData": "appModelData"
    }
  },
  "channels": ["channel1", "channel2"],
  "apiKey": "BFAPI_GENERATED-API-KEY"
}
BF Action
messageSend
messageSendAnonChannel