Skip to content
forked from xanecs/axiom

MQTT-Interface for the WhatsApp messaging service

License

Notifications You must be signed in to change notification settings

nanky130704/axiom

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Axiom

Axiom is a python program that connects to a mqtt server and provides an interface to the WhatsApp messaging service.

Installation

  1. Clone this repo.
  2. Install dependencies
pip install yowsup2 paho-mqtt
  1. Edit waserver/config.py. Credentials can be required from the yowsup2 cli. See here.
  2. Run
python waserver/waserver.py

Docker

  1. Create a waserver/config-prod.py
  2. The build the image with the provided Dockerfile. The seperate config files allow for different dev/production configs.

MQTT interface

Incoming messages

To receive messages subscribe to whatsapp/incoming. A message will look like this:

{
  "phone": "4915112345678",
  "message": "Hello from a human being!"
}

Phone number in this example would normally be spelled +49 151 12345678. For group messages, the phone number is in the form 4915112345678-1400000000 (phone number of the group creator and unix timestamp of creation).

Sending messages

To send messages, publish to whatsapp/outgoing:

{
  "phone": "4915112345678",
  "message": "Hello from a bot!"
}

Commands

Currently there is only on command implemented

Group Info

To receive group info (members, title), publish to whatsapp/cmd

{
  "cmd": "group_info",
  "phone": "4915112345678-1400000000",
  "callback": "any_string_here"
}

The callback will be used to identify the response to this command. It is advisable to use a UUID for this. The response will be published to the whatsapp/iq topic:

{
  "cmd": "group_info",
  "callback": "any_string_here",
  "groupId": "4915112345678-1400000000",
  "participants": {
    "4915112345678": "admin",
    "4915187654321": null,
  },
  "subject": "Example group"
}

About

MQTT-Interface for the WhatsApp messaging service

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%