# Self-Service Flow
Additional Relevant Docs:
- https://miro.com/app/board/uXjVNlZcluM=/?share_link_id=648918833872
- https://webhook.site/#!/view/fd13513d-add5-42e0-b043-c99fc1bba46a/910cc3f5-e13c-480f-b1a5-bb4c9e28adc5/1
- https://console.twilio.com
## Current version
### Registration (Part 1)
```mermaid
sequenceDiagram
autonumber
participant User
participant Wix
participant Stripe
participant App
participant Mandrill
participant Team as Team Member
User->>Wix: Selects a product
User->>Wix: Enters personal & company information
Wix->>Stripe: Redirects for payment
Stripe->>App: Webhook HTTP POST: Customer Subscription Succeeded
alt Single User
App->>Mandrill: HTTP POST: Triggers Confirmation email to User
else Enterprise Admin User
App->>Mandrill: HTTP POST: Triggers Confirmation email to User with redirect to Enterprise Administration Provisioning Portal
App->>App: Create an Enterprise for the Enterprise Admin so all following users can be configured under this Enterprise
end
Mandrill-->>User: Confirmation Email Sent with Registration link for respective product
Note over User: User received Self-Registration Link
User->>App: Self Registers with
note over User, App: Enterprise info, SMS Enabled Number, Email address,
User->>App: Create Enterprise and Create Mapping
Mandrill->>User: Welcome Email Sent
Note over User,Mandrill: Single/Admin User is provisioned
alt Enterprise Admin User
User->>Stripe: Log into customer portal to add licenses
Stripe->>App: Webhook HTTP POST: Team Member Customer Subscription Succeeded
App->>App: Invite Team members based off of available licenses
end
note over User, Team: See Part 2 below
```
### Onboarding (Part 2)
Prerequisite:
- User or Team Member has Paid for a license in Stripe.
```mermaid
sequenceDiagram
autonumber
participant User as Any User
participant Wix
participant Stripe
participant App
participant Mandrill
note over App: for Admin User or Team Member
App->>Mandrill: Trigger Onboarding Email
Mandrill->>User: Onboarding Invite EMAIL: Payment Received, please complete your onboarding here <LINK>
User->>App: Visits Signup Page
User->>App:Enter Email address
App->>Stripe: Lookup email and check if available license for this email exists
alt License Available
User->>App: Provides Team Admin email (to lookup enteprise)
note over App: Or use this method: Invited team users self-register on https://context-teams.sabrhub.com/single-user?enterpriseId=E90909 as like a single user.
App->>User: Do you have access to Teams/Webex Calling? If so, please access it now for number verification
User->>App: Enter SMS Enabled Number
App->>App: Trigger 2FA Voice Call via Twilio Verify to SMS Enabled number to confirm that User infact has access to this voice number
App->>App: Add Mapping based on Cisco personEmail field
note over App: See Webhook.site for unprovisionedlogger which captures personEmail with exact case from Webex
end
Note over App,Mandrill: Teammates are provisioned
```
### MS Teams Self-service Flow (Darius)
1. A single user(a mapping)
- Selects a product(for a single user) on wix and pays a subscription on stripe.
- Send a confirmation email(with self-registration link) to User in stripe webhook handler on app backend.
- Self-Register the user(SMS number and email) by clicking the registration link to https://context-teams.sabrhub.com/single-user.
MS Teams: saves in Cognito and mappings
Webex: saves in only mappings
2. An enterprise admin
- Selects a product(for an enterprise admin) on wix and pays a subscription on stripe.
- Send a confirmation email(with creating enterprise link) to User in stripe webhook handler on app backend.
- Login with the enterprise admin account by clicking the provisioning portal link to https://context-teams.sabrhub.com/enterprise-admin and go to enterprise page to add licenses.
- click "Invite Team members" in upper-right on enterprise page
- redirect to stripe and pays multiple licenses(with n quantities) on stripe.
- redirect invite page. There invite Team members with n available email inputs.
- Send Confirmation emails(with self-registration link) to signup to invited Team users.
- Invited team users self-register on https://context-teams.sabrhub.com/single-user?enterpriseId=E90909 as like a single user.
# Ignore
```mermaid
sequenceDiagram
participant User
participant Wix
participant Stripe
participant App
participant Mandrill
participant Team as Team Member
User->>Wix: Selects a product
User->>Wix: Enters personal, company, and SMS Enablement information
Note over Wix: Collect all necessary information upfront to minimize steps.
Wix->>Stripe: Redirects for payment
alt Payment Successful
Stripe->>App: Webhook HTTP POST: Customer Subscription Succeeded
App->>Mandrill: HTTP POST: Triggers Welcome & Confirmation email with Self-Registration link to User
Note over User: User proceeds to Self Registration with SMS Enabled Number and Email address
else Payment Failure
Stripe->>User: Displays payment error, offers to retry
end
User->>App: Completes Self Registration
App->>App: Verify Email and SMS Number, provision User Account
App->>Mandrill: Welcome Email Sent
User->>App: Accesses Dashboard to Add Team Members (based on available licenses)
Note over App: Streamline team addition by integrating it within the App dashboard.
loop Each Team Member
App->>Mandrill: Send Invitation Email with Sign-Up Link
Mandrill-->>Team: Invitation Email Sent
Team->>App: Completes Sign-Up
App->>Stripe: Verifies License Status: Active
Stripe-->>App: Confirms Status: Active
App->>App: Provisions Team Member Account
App->>Mandrill: Welcome Email Sent to Team Member
end
Note over App,Mandrill: Users and Teammates are seamlessly provisioned
```
# Archive
```mermaid
graph TB
A[User] --> B[Selects a product]
B --> C[Enters personal & company information]
C --> D{Payment Processed within App}
D --> |Succeed| E[Confirmation & Welcome Email Sent]
E --> F[User Self-Registers]
F --> |Single User| G[User is provisioned]
F --> |Enterprise Admin User| H[Admin sets up Enterprise and Manages licenses]
H --> I[Invites Team members with available licenses]
I --> J[Team Signs Up]
J --> K{License Status: Active}
K --> |Yes| L[User is added under Enterprise]
L --> M[Welcome Email Sent to Team Member]
M --> N[Team member is provisioned]
```
### draft
```mermaid
sequenceDiagram
participant User
participant Wix
participant Stripe
participant App
participant Mandrill
participant Team as Team Member
User->>Wix: Selects a product
User->>Wix: Enters personal & company information
User->>Wix: Enters SMS Enablement Information
Note over Wix: SMS Enabled Number, Cisco Webex ID,
Wix->>Stripe: Redirects for payment
Stripe->>App: Webhook HTTP POST: Customer Subscription Succeeded
App->>Mandrill: HTTP POST: Triggers Confirmation email to User
Mandrill-->>User: Confirmation Email Sent
Mandrill->>User: Welcome Email Sent
Note over User,Mandrill: User is provisioned
User->>Stripe: Log into customer portal to add licenses
Stripe->>App: Webhook HTTP POST: Team Member Customer Subscription Succeeded
App->>Mandrill: Sends email for team to sign up
Mandrill-->>Team: Confirmation Email Sent
Team->>Wix: Signs up Using Sign Up Form
Wix->>App: Create New User
App->>Stripe: Check if License Status: Active
Stripe-->>App: Status: Active
App->>App: Add User/Mapping Under Existing Enterprise
App->>Mandrill: HTTP POST: Triggers Confirmation email to User
Mandrill->>Team: Welcome Email Sent
Note over App,Mandrill: Teammates are provisioned
```
# Ignore
User->>Wix: Selects Product
Wix->>Stripe: User pays for product
Stripe->>App: Webhook POST on successful Payment
```mermaid
graph TD
User["User"] -->|Selects a product| Wix["Wix"]
Wix -->|Enters personal & company information| Stripe["Stripe"]
Stripe -->|Redirects for payment| App["App"]
App -->|Webhook HTTP POST: Customer Subscription Succeeded| Mandrill["Mandrill"]
Mandrill -->|Confirmation Email Sent with Registration link| User
User -->|Self Registers with SMS Enabled Number and Email address| App
App -->|Welcome Email Sent| Mandrill
User["User"] -->|Log into customer portal to add licenses| Stripe["Stripe"]
Stripe -->|Webhook HTTP POST: Team Member Customer Subscription Succeeded| App["App"]
App -->|Invite Team members based off of available licenses| App
App -->|Sends email for team to sign up| Mandrill["Mandrill"]
Mandrill -->|Confirmation Email Sent| Team["Team"]
Team -->|Provides Team Admin email| App
Team -->|Signs up Using Sign Up Form| App
App -->|Create New User/Mapping| App
App -->|Check if License Status: Active| Stripe
Stripe -->|Status: Active| App
App -->|Add User/Mapping Under Existing Enterprise| App
App -->|Triggers Confirmation email to User| Mandrill
Mandrill -->|Welcome Email Sent| Team
```
```mermaid
graph TD
User["User"] -->|Selects a product| Wix["Wix"]
Wix -->|Enters personal & company information| Stripe["Stripe"]
Stripe -->|Redirects for payment| App["App"]
App -->|Webhook HTTP POST: Customer Subscription Succeeded| Mandrill["Mandrill"]
Mandrill -->|Confirmation Email Sent with Registration link| User
User -->|Self Registers with SMS Enabled Number and Email address| App
App -->|Welcome Email Sent| Mandrill
User["User"] -->|Log into customer portal to add licenses| Stripe["Stripe"]
Stripe -->|Webhook HTTP POST: Team Member Customer Subscription Succeeded| App["App"]
App -->|Invite Team members based off of available licenses| App
App -->|Sends email for team to sign up| Mandrill["Mandrill"]
Mandrill -->|Confirmation Email Sent| Team["Team"]
Team -->|Provides Team Admin email| App
Team -->|Signs up Using Sign Up Form| App
App -->|Create New User/Mapping| App
App -->|Check if License Status: Active| Stripe
Stripe -->|Status: Active| App
App -->|Add User/Mapping Under Existing Enterprise| App
App -->|Triggers Confirmation email to User| Mandrill
Mandrill -->|Welcome Email Sent| Team
%% Styling
style Wix,Stripe,App,Mandrill,User,Team fill:#f9f,stroke:#333,stroke-width:2px
style Wix,Stripe,App,Mandrill,User,Team text-align:center
```
```mermaid
sequenceDiagram
participant User
participant Wix
participant Stripe
participant App
participant Mandrill
participant Team as Team Member
User->>Wix: Selects a product and enters personal & company information
Wix->>Stripe: Redirects for payment
Stripe->>App: Notifies payment success via webhook
alt Single User or Enterprise Admin User
App->>Mandrill: Sends confirmation email with specific instructions
Mandrill-->>User: Confirmation Email Sent
Note over User: User proceeds to self-register
User->>App: Completes self-registration
Mandrill->>User: Sends Welcome Email
Note over User: User is now provisioned
else Enterprise Admin adding licenses
User->>Stripe: Manages licenses in customer portal
Stripe->>App: Notifies license changes via webhook
App->>App: Adjusts enterprise license count and invites team members
App->>Mandrill: Emails team member signup instructions
Mandrill-->>Team: Invitation Email Sent
Team->>App: Signs up and is associated with the enterprise
App->>Stripe: Verifies license status
Stripe-->>App: Confirms status
App->>Mandrill: Sends Welcome Email to Team Member
Note over Team: Team member is now provisioned
end
```
```mermaid
sequenceDiagram
participant User
participant Wix
participant Stripe
participant App
participant Mandrill
participant Team as Team Member
User->>Wix: Selects a product
User->>Wix: Enters personal & company information
Wix->>Stripe: Redirects for payment
Stripe->>App: Webhook HTTP POST: Customer Subscription Succeeded
App->>Mandrill: HTTP POST: Triggers Confirmation email to User
Mandrill-->>User: Confirmation Email Sent with Registration link for respective product
Note over User: User received Self-Registration Link
User->>App: Self Registers with SMS Enabled Number and Email address
Mandrill->>User: Welcome Email Sent
Note over User,Mandrill: Single/Admin User is provisioned
alt Enterprise Admin User
User->>Stripe: Log into customer portal to add licenses
Stripe->>App: Webhook HTTP POST: Team Member Customer Subscription Succeeded
App->>App: Invite Team members based off of available licenses
App->>Mandrill: Sends email for team to sign up
Mandrill-->>Team: Confirmation Email Sent
Team->>App: Signs up Using Sign Up Form
App->>App: Create New User/Mapping
App->>Stripe: Check if License Status: Active
Stripe-->>App: Status: Active
App->>App: Add User/Mapping Under Existing Enterprise
App->>Mandrill: HTTP POST: Triggers Confirmation email to User
Mandrill->>Team: Welcome Email Sent
Note over App,Mandrill: Teammates are provisioned
end
```