BMP: Create Interaction
An interaction is a file that contains your server side code.
Â
Before You Start:
Before you run the Create Interaction command, you will first need to ensure you've done a "pull" request at least once. This will create the directory structure you need on your local machine.
Â
Directory Structure Overview
Once you have pulled your project down, you will notice a structure will have been created within your working directory.
The folder named "interactions" will contain all of your interactions. Each interaction is saved within its own folder, and within these folders are two files - a JSON configuration file (which you generally don't need to modify), and a PHP file for your server side code. New files can be created using the create interaction command.
Â
Naming Conventions
Code editors and IDEs show code formatting, styling and indenting based on the file extension of the file being viewed. In order to see pretty code formatting when viewing your BMP interaction code in a code editor you will have to follow the instructions shown in the Further Reading section, under "Naming your BMP Interactions".
Â
Create a New Interaction
To create a new interaction, you can run the command:
bm bmp create interaction <interaction name>
Keep in mind the interaction name is used in the URL to access the script, so make sure you use only alphanumeric characters, and no spaces.
This will create the folder and files locally.
Â
Additional Options
--type
The "type" option will allow you to change the type of interaction you create. If you leave this out, it will default to "madl".
Valid options are:
madl :Â "madl" interactions will allow you to run PHP code. (default)
message :Â "message" interactions will allow you to run HTML and Javascript content, however in most cases you will probably prefer to use the Client CLI
Â
bm bmp create interaction <interaction name> --type madl
--remote
As well as creating your new interaction locally, the --remote option will also instantly create this new interaction within your answerSpace.
bm bmp create interaction <interaction name> --remote
Â
Next Steps
Â
Â