Skip to content

FromDoppler/doppler-push-contact

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API contracts

Add new push contact

sequenceDiagram
  participant User
  participant Browser
  participant PushScript
  participant Firebase
  participant PushContactApi
  participant PushApi
  participant MongoDb

User->>Browser: get page
activate Browser
Browser->>PushScript: exec
deactivate Browser
activate PushScript
PushScript->>+Firebase: requestPermision (popup)
Firebase-->>-PushScript: FCM: permission granted
PushScript->>Firebase: get device token
Firebase-->>PushScript: device token
PushScript->>+PushContactApi: POST /push-contacts
PushContactApi->>+PushApi: GET /devices/{token}
PushApi-->>-PushContactApi: device token information
PushContactApi->>MongoDb: store push contact
PushContactApi-->>-PushScript: add push contact response
PushScript-->>Browser: device token
deactivate PushScript

User->>Browser: complete email
activate Browser
Browser->>PushScript: email
deactivate Browser
activate PushScript
PushScript->>+PushContactApi: PUT /push-contacts/{deviceToken}/email
PushContactApi->>MongoDb: update push contact email
PushContactApi-->>-PushScript: update push contact email response
deactivate PushScript
Loading

Send push notification from Doppler by domain

sequenceDiagram
  participant DopplerUser
  participant Doppler
  participant PushContactApi
  participant PushContactApiWorker
  participant MongoDb
  participant PushApi
DopplerUser->>+Doppler: send push notification to specific domain
Doppler->>+PushContactApi: POST /push-contacts/{domain}/message
PushContactApi-x+PushContactApiWorker: send async
PushContactApi-->>-Doppler: messageId
Doppler-->>-DopplerUser: shipment in progress!

PushContactApiWorker->>+MongoDb: get device tokens by domain
MongoDb-->>-PushContactApiWorker: device tokens
PushContactApiWorker->>+PushApi: POST /message
PushApi-->>-PushContactApiWorker: shipping results
PushContactApiWorker->>MongoDb: delete not valid push contacts
PushContactApiWorker->>MongoDb: add push contacts history events
PushContactApiWorker->>MongoDb: add sent message details
deactivate PushContactApiWorker
Loading

Enable/disable push feature in specific domain from Doppler

sequenceDiagram
  participant DopplerUser
  participant Doppler
  participant PushContactApi
  participant MongoDb
DopplerUser->>+Doppler: enable/disable push feature in specific domain
Doppler->>+PushContactApi: PUT /domains/{name}
PushContactApi->>+MongoDb: upsert domain
PushContactApi-->>-Doppler: success
Doppler-->>-DopplerUser: done!
Loading

Get push feature status by domain name

sequenceDiagram
  participant ApiConsumer
  participant PushContactApi
  participant MongoDb
ApiConsumer->>+PushContactApi: GET /domains/{name}/isPushFeatureEnabled
PushContactApi->>+MongoDb: get push feature status by domain
PushContactApi-->>-ApiConsumer: push feature status
Loading

Get Automation report

sequenceDiagram
  participant DopplerUser
  participant Doppler
  participant PushContactApi
  participant MongoDb
DopplerUser->>+Doppler: get Automation report
loop for each sent message
  Doppler->>+PushContactApi: GET push-contacts/{domain}/messages/{messageId}/details
  PushContactApi->>+MongoDb: get message details
  MongoDb->>-PushContactApi: message details
  PushContactApi-->>-Doppler: message details
end
Doppler->>+DopplerUser: Automation report
Loading

MongoDB ER diagram

diagrama ER mongodb push notifications

To run the backend services

  1. Run the backing-services-stack.yml file: To start up the services defined in backing-services-stack.yml file, use the following command:

    docker-compose -f backing-services-stack.yml up

    If you want them to run in the background (detached mode), add the -d option:

    docker-compose -f backing-services-stack.yml up -d
  2. Stop the services: To stop and remove the services use the following command:

    docker-compose -f backing-services-stack.yml down