Clicking Connect button on Integrations modal in Contacts page opens a new tab by calling - /omnisend/connect-site?site_id=${window.SITE}&connected_from=contacts-page&sync_existing_contacts=true (Omnisend_contacts_controller.rb) which redirects to authorization api if site_id exists - /users/oauth_omnisend/authorize (oauth_omnisend_controller.rb)
If authorization is successfull, then it redirects back to /omnisend/connect-site but this time with no url params
omnisend_oauth_data which was a response from Omnisend containing access_token, refresh_token, etc is stored into integrations property of site found by site_id
OmnisendContactsWorker is being called if sync_existing_contacts=true was passed as an url param. This worker creates contacts in Omnisend by copying them from POWR contacts
OmnisendContactsWorker is also triggered when new contact is created in POWR, thus, creating a contact in Omnisend
Clicking Diconnect button on Integrations modal in Contacts page calls /omnisend/disconnect-site/${window.SITE} deletes Omnisend information saved in integrations property of the site