To configure a Wickr IO webhook bot on an Amazon EC2 Linux instance, complete the following steps:
-
Open the Wickr admin console. Then, create a bot user. If you can't open the Wickr admin console, then use a Wickr network administrator to create the bot user.
Note: The default password policy requires at least 8 characters for a password. Also, make sure that the account name suffix contains bot.
-
Launch an Amazon Linux 2023 instance to deploy the container:
$ sudo yum update -y
$ sudo dnf install docker
$ sudo systemctl enable docker
$ sudo systemctl start docker
-
Create the /opt/WickrIO folder:
$ mkdir /opt
$ cd /opt
$ mkdir WickrIO
-
Deploy the Wickr IO client container. Specify port mapping to 8080 to receive requests. This action automatically enters the container's command line.
$ sudo docker pull public.ecr.aws/x3s2s6k3/wickrio/bot-cloud:latest
$ sudo docker run -v /opt/WickrIO:/opt/WickrIO -p 8080:8080 -ti public.ecr.aws/x3s2s6k3/wickrio/bot-cloud:latest
-
Agree to the license agreement.
-
At the prompt, enter add to add a new client, and then enter the username and password that you created.
Example:
Note: Replace example-webhook-bot with your username and example-password with your password.
WARNING: Please make sure you include the -t -i (or -ti) option when starting
the WickrIO docker container with the docker run command. This will allow you
to attach and detach from the WickrIO console.
Continue to see welcome message on startup? (default: yes):yes
Enter command:add
Enter the user name:example-webhook-bot
Enter the password:example-password
Creating user:example-webhook-bot"
Begin registration with password.
Begin register new user context.
Successfully created user
Successfully logged in as new user!
Our work is done here, logging off!
The autologin capability allows you to start a bot without having to enter the
password, after the initial login.
NOTE: The bot client's password is NOT saved to disk.
Do you want to use autologin? (default: yes):yes
-
To configure the wickrio-webhook-bot integration, complete the following steps:
To match the container mapping, use port 8080 for integration.
Use the Amazon EC2 instance's public IP address when you specify the webhook receiver endpoint.
To make sure that you have a static public IP address, associate an Elastic IP address to your Amazon EC2 instance.
Example:
Note: Replace example-wickrio-webhook-bot with your bot integration.
Enter the bot integration to use:example-wickrio-webhook-bot
**********************************************************************
Begin setup of wickrio-webhook-bot software for example-webhook-bot
v16.20.2
6.20.1
npm notice
npm notice New major version of npm available! 8.19.4 -> 10.5.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.5.0
npm notice Run npm install -g npm@10.5.0 to update!
npm notice
Copying wickrio-webhook-bot from the NPM registry
Searching NPM registry
Searching NPM registry
Searching NPM registry
Searching NPM registry
Searching NPM registry
Installing example-wickrio-webhook-bot software
Begin configuration of example-wickrio-webhook-bot software for example-webhook-bot
Select a port for the bot HTTP server [8080]:8080
Enter the frontend URL for your webhook receiver :exampl-webhook-bot-ip
Integration files written to:
/opt/WickrIO/clients/client-webhook-bot/integration/example-wickrio-webhook-bot
End of setup of example-wickrio-webhook-bot software for example-webhook-bot
**********************************************************************
Successfully added record to the database!
-
To confirm the client order and start the client, complete the following steps:
To view the available clients, enter the list command at the prompt.
Locate the client that you want to start. Note the index number #.
To start the client, enter start [index #] at the prompt. For example, if the index number is 0, then enter start 0.
After you enter the start command, enter list again to verify that the client's status is Running.
Example:
Enter command:list
Current list of clients:
# Name Status Integration Version Misc
=======================================================================
0 example-webhook-bot Paused wickrio-webhook-bot unknown
Enter command:start 0
Preparing to start the client with the name example-webhook-bot
Do you really want to start the client with the name client-webhook-bot:yes
Enter password for this client:********
Enter command:list
Current list of clients:
# Name Status Integration Version Events Misc
================================================================================
0 example-webhook-bot Running wickrio-webhook-bot unknown 1
-
To test the service port, navigate to http://example-ip-address:8080. The following is shown:
Cannot GET /
Note: If the previous step fails, then check the security group and network settings in your Amazon EC2 instance.
-
Create a regular Wickr user and log in to the Wickr client.
-
Create a room, and then add the example-webhook-bot bot user as a moderator. This value is required to allow messaging.
-
To show the room's request URL in the chat window, enter /show:
Example output:
http://example-ip-address/send/example-webhook-id
-
To send a test message to the room, use curl. Make sure that you specify port 8080:
Note: Replace example-ip-address with the IP address and example-webhook-id with the webhook ID that you retrieved from the previous step.
curl http://example-ip-address:8080/send/example-webhook-id -d 'payload={"text": "hello world"}'