如何使用WhatsApp Business API访问Wacore容器

时间:2018-08-16 10:25:06

标签: docker-compose whatsapp

我最近开始使用WhatsAppBusiness API,我能够为whatsappbusiness安装docker容器,并且能够使用端口9090访问whatsapp Web。 例如:https://172.29.208.1:9090

但是我不知道如何访问MySQL和WhatsAppCore应用。

我尝试了http://172.29.208.1:33060,但没有任何反应。请让我知道如何访问MySQL和wacore。

这是我的docker-compose.yml文件

docker-compose.yml

version: '3'

volumes:
  whatsappData:
    driver: local
  whatsappMedia:
    driver: local

services:
  db:
    image: mysql:5.7.22
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: testpass
      MYSQL_USER: testuser
      MYSQL_PASSWORD: testpass
    expose:
        - "33060"
    ports:
        - "33060:3306"
    network_mode: bridge
  wacore:
    image: docker.whatsapp.biz/coreapp:v2.19.4
    command: ["/opt/whatsapp/bin/wait_on_mysql.sh", "/opt/whatsapp/bin/launch_within_docker.sh"]
    volumes:
     - whatsappData:/usr/local/waent/data
     - whatsappMedia:/usr/local/wamedia
    env_file:
      - db.env
    depends_on:
      - "db"
    network_mode: bridge
    links:
      - db
  waweb:
    image: docker.whatsapp.biz/web:v2.19.4
    command: ["/opt/whatsapp/bin/wait_on_mysql.sh", "/opt/whatsapp/bin/launch_within_docker.sh"]
    ports:
     - "9090:443"
    volumes:
     - whatsappData:/usr/local/waent/data
     - whatsappMedia:/usr/local/wamedia
    env_file:
      - db.env
    environment:
      WACORE_HOSTNAME: wacore
    depends_on:
      - "db"
      - "wacore"
    links:
      - db
      - wacore
    network_mode: bridge

1 个答案:

答案 0 :(得分:1)

Mysql不是HTTP服务器,它不理解http://172.29.208.1:33060

您可以运行'docker ps | grep mysql'获取mysql容器ID

  

8dfa30ab0200 mysql:5.7.22“ docker-entrypoint.s…” 6分钟前向上6分钟33060 / tcp,0.0.0.0:33060->3306/tcp xxxx_db_1

然后运行'docker exec -it 8dfa30ab0200 mysql -h localhost -P 3306 -u testuser --password = testpass'以访问mysql

但是因为您还没有注册,所以您不会在mysql中看到很多东西。请按照https://developers.facebook.com/docs/whatsapp/api/account中的步骤执行注册。

您不需要直接访问coreapp,您可以通过webapp(https://172.29.208.1:9090)执行所有API请求。