Web Server Daemon
Beam's send commands are great to quickly send some data through Somewear. But you likely need Beam to be constantly running. For this, you can run Beam as a daemon and make HTTP requests to it instead of CLI commands to send payloads.
Run Beam Web Server
beam up
Once this is running, you can make requests to Beam's web APIs. For example, here's some cURL requests you can try out.
Send a Message
curl -X POST http://localhost:9091/api/package -H 'Content-Type: application/json' -d '{ "message": { "content": "Test" }, "workspaceId": <YOUR_WORKSPACE_ID> }'
Send a Data Payload
curl -X POST http://localhost:9091/api/package -H 'Content-Type: application/json' -d '{ "data": { "payload": "VGVzdAo=" }, "workspaceId": <YOUR_WORKSPACE_ID> }'
Keep Beam Running
You'll likely want to keep Beam running if your host is rebooted or if the process is terminated for some reason. For this, we recommend using your preferred service manager, such as systemd on Linux. We don't have sample service definitions for you to use at the moment, but if you're interested just let us know!
Last updated