Quick Start

This page provides a quick introduction to Wavel and introductory examples. If you have not already installed, Wavel, head over to the Installation page.

Installing Open WA

Use this command to install the library for the first time and to keep the library up to date.

npm i --save @open-wa/wa-automate@latest

Argument list

Argument

Description

-p, --port

Set the port for the api. Default to 8002

--api-host

The easy API may be sitting behind a reverse proxy. In this case set --api-host in order to make sure the api docs and api explorer are working properly. You will need to include the protocol as well.

-w, --webhook

Webhook to use for the listeners.

-k, --key

Specify an api key to use as a check for all requests. If you add -k by itself, a key will be auto generated for you.

For more detail each argument use this command

npx @open-wa/wa-automate --help

Running on a server

If you're not running this on your localhost, you'll need to set the server hostname for the api-docs to work correctly.

npx @open-wa/wa-automate -p 8080 --api-host 'https://my-wa-api.dev:8080'

The environment should be

WAVEL_HOST=https://my-wa-api.dev:8080

Example usage for standalone should be

$wavel = new Ardzz\Wavel\WavelFactory(
    wavelHost: 'https://my-wa-api.dev:8080'
);

Webhook client

You can also set a webhook address to send all requests

npx @open-wa/wa-automate -w 'https://my.laravel.project/wavel_webhook_server'

Use webhook and securing server

In order to protect the API server, you must set the API key

npx @open-wa/wa-automate -p 8080 -k 'S3Cr3T_K3y' --api-host 'https://my-wa-api.dev:8080' 

The environment should be

WAVEL_HOST=https://my-wa-api.dev:8080
WAVEL_API_KEY=S3Cr3T_K3y

Example usage for standalone should be

$wavel = new Ardzz\Wavel\WavelFactory(
    wavelHost: 'https://my-wa-api.dev:8080',
    wavelApiKey: 'S3Cr3T_K3y'
);

Last updated

Was this helpful?