Hooks server

General description

Hooks server is a component responsible for gathering information available by webhooks from other applications (Facebook, Twilio, Twitter and Automate platform) and distributing them across other services to make proper actions.

API

Default port is: 8069

Application has got public HTTP API which has to be available by other applications webhooks (e.g. Facebook, Twilio).

There are default endpoints for monitoring purposes. They are described in Components monitoring section.

Databases

ElasticSearch

The application asks for data in ElasticSearch needed to pass the thread to an agent in React app.

RabbitMQ

This application connects to RabbitMQ in order to persist all incoming messages and to guarantee they will be processed even in case of temporary downtime of application.

The component writes data to queues:

  • webhooks.facebook.XXX - used for webhooks from Facebook
  • webhooks.twitter.XXX - used for webhooks from Twitter
  • webhooks.twilio.XXX - used for webhooks from Twilio
  • webhooks.automate.XXX - used for handover requests from Thread Coordinator

Communication

This service communicates with the following services:

ApplicationConfig to URLAuthDirection
Twilio APIhookServer.publicUrlToken-basedInbound
Facebook APIhookServer.publicUrlToken-basedInbound
Twitter APIhookServer.publicUrlToken-basedInbound
Thread CoordinatorthreadCoordinator.urlOTPInbound/Outbound
ReacthookServer.webApiUrlOTPOutbound

Config

Application's config

hookServer:
  publicUrl: "https://REACT_HOOKS_SERVER_PUBLIC_URL"
  facebook:
  	enabled: true
    processEnabled: true
    workerCount:
    	default: 1
      spam: 1
      special: 1
   	spamThreshold: 2000 # /30min
  twitter:
  	enabled: false
    processEnabled: false
    sleepAfterError: 300 # sec
    subscribeInterval: 900 # sec
    maxSubscribers: 15
    priorityCompanies: []
    envName: DEFAULT
  twilio:
  	processEnabled: true
  automate:
  	processEnabled: true
    otpSecret: "PUT_SECRET_HERE"
  webApiUrl: "https://REACT_WEB_API_URL"

Database configuration

elasticsearch:
  v6.5:
    host: ["ES_HOST1", "ES_HOST2"]
    httpPort: ES_HTTPPORT # Default 9200
    port: ES_TRANSPORTPORT # Default 9300
    clusterName: "ES_CLUSTERNAME"
    secure: true
    username: "ES_USERNAME"
    password: "ES_PASSWORD"
    certificatePath: "CERTIFICATE_PATH"
statementsQueue:
  rabbitmq:
    hosts:
    - "RABBITMQ_HOST1:RABBITMQ_PORT"
    - "RABBITMQ_HOST2:RABBITMQ_PORT"
    - "RABBITMQ_HOST3:RABBITMQ_PORT"
    username: "RABBITMQ_USERNAME"
    password: "RABBITMQ_PASSWORD"

Play Framework config

More information about Play Framework could be found in Play Framework configuration section