Beacon API Docs
  • Beacon - Installation
  • Beacon - Usage
    • Beacon Usage - Overview
    • Usage in a Next.js Environment
    • Open and Close Programmatically
  • Native Routing in Beacon
    • Vanilla JS - Native Routing Example
    • React JS - Native Routing Example
    • Vue JS - Native Routing Example
    • Angular JS - Native Routing Example
  • Loading User Data into BeaconBar
  • Loading Session Data into Beacon Bar
  • Callbacks in Beacon
    • Add Callbacks in Beacon
    • Remove Callbacks in Beacon
    • React Example for Callbacks
  • Trigger smart journeys From Your App
  • Execute Command From Your App
  • Open Help Docs From Your App
  • Emitting Events to Beacon
  • Listening to events from Beacon Bar
    • Adding event listeners in Beacon
    • Removing event listeners in Beacon
    • React Example for Event Listeners in Beacon
  • List of events emitted by Beacon Bar
  • Implementing Content Security Policy (CSP) for Beacon Integration
Powered by GitBook
On this page

Execute Command From Your App

Commands in the @beacon.li/bar package allow you to trigger specific actions or operations within your app, providing a way to interact with your application's functionality programmatically.

Executing a Command

To execute a command from your app, you can use the Beacon.executeCommand method. This method takes one parameter:

  • commandId (string): The unique identifier of the command you want to execute.

Here's how to use it:

import { Beacon } from '@beacon.li/bar';
Beacon.executeCommand('commandId');

In the example above, we are executing a command with the ID 'commandId'. This will trigger the specific action associated with that command within your app.

Use Cases

Commands can be used for a variety of purposes, such as:

  • Automating tasks or actions within your app.

  • Responding to user interactions with the Beacon widget.

  • Integrating with external services or APIs based on user requests.

By incorporating commands into your app using @beacon.li/bar, you can provide users with a seamless and interactive experience, allowing them to perform actions or operations with ease.

Important Consideration

When defining commands and their associated actions in your app, ensure that you have a clear understanding of what each command does and that it aligns with your app's functionality and user experience.

By following these steps, you can execute commands programmatically within your app using the Beacon.executeCommand method from @beacon.li/bar.

PreviousTrigger smart journeys From Your AppNextOpen Help Docs From Your App

Last updated 1 year ago