Sabeeh Hameed
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Enterprise Chat Application: Development Guide ## Introduction This document outlines the development plan for an enterprise chat application that facilitates chat between business representatives using a web chat application or Microsoft Teams, and their customers via SMS. The solution integrates SendBird for the chat interface, Bandwidth for SMS and MMS capabilities, AWS Cognito for user authentication and single sign-on, and DynamoDB for message storage. GDPR compliance is paramount. ## Non-Functional Requirements (NFR) 1. **Scalability**: The system should support up to 20,000 users simultaneously. 2. **Security**: All user data and messages must be encrypted both in transit and at rest. 3. **Responsiveness**: The chat UI should be real-time without any perceptible delay. 4. **Compliance**: GDPR compliance to ensure user data protection. 5. **Integration**: Seamless integration with MS Teams and a custom web chat application. ## Functional Requirements (FR) 1. **User Authentication**: Users should authenticate using Single Sign-On through AWS Cognito. 2. **Chat Interface**: Utilize SendBird to facilitate real-time chat on web and MS Teams. 3. **SMS Communication**: Allow for business representatives to send SMS to customers using Bandwidth API. 4. **MMS Communication**: Extend chat functionality for multimedia (image/video) transfers. 5. **Message Logging**: All messages should be saved in the existing DynamoDB instance for record-keeping and potential analytics. ## Architecture This diagram will depict how various components interact within the system. ```mermaid graph LR T[Teams SSO] --> |Federation| A A[AWS Cognito] -->|Authentication| B[Web Chat Application / MS Teams] B -->|Initiate Chat| C[SendBird Chat] C -->|Send/Receive SMS/MMS| D[Bandwidth SMS/MMS API] D --> E[Customer's Mobile] subgraph Amazon AWS C F[DynamoDB] G[AWS Elastic Beanstalk] end D -->|Log Messages| F B -->|Deploy| G style A fill:#f9d,stroke:#333,stroke-width:2px style B fill:#fdc,stroke:#333,stroke-width:2px style C fill:#bfd,stroke:#333,stroke-width:2px style D fill:#edc,stroke:#333,stroke-width:2px style E fill:#cfd,stroke:#333,stroke-width:2px style F fill:#adf,stroke:#333,stroke-width:2px style G fill:#dfe,stroke:#333,stroke-width:2px ``` Here's the breakdown of the diagram: - **AWS Cognito**: Represents the Single Sign-On system. This is where users will authenticate. - **Web Chat Application / MS Teams**: This is the frontend where your enterprise users will interact. They will authenticate using AWS Cognito and then get directed here. - **SendBird Chat**: This is the chat backend handling real-time messaging on the web app and MS Teams. - **Bandwidth SMS/MMS API**: This is responsible for sending and receiving SMS and MMS messages to/from customers. - **Customer's Mobile**: Represents the endpoint of the SMS/MMS communication. - **DynamoDB**: This is where messages are logged and stored. - **AWS Elastic Beanstalk**: Represents the deployment environment for your web application. The arrows indicate the flow of information and interaction between the components. For example, once authenticated through AWS Cognito, users can access the chat application. When a message is initiated from the chat application, it goes through SendBird, which then communicates with Bandwidth API to send an SMS or MMS. Similarly, incoming messages will traverse the same path in reverse. All messages are logged in DynamoDB. The entire system, except the customer's mobile, resides within the AWS ecosystem. ## Message Flow Sequence diagram illustrating the interaction flow between the user, Web Chat / MS Teams interface, SendBird backend, and Bandwidth SMS API, along with API samples: ```mermaid sequenceDiagram participant User participant WebChat participant SendBird participant BE participant Bandwidth participant DynamoDB as MessageDB User ->> WebChat: Login WebChat ->> SendBird: Authenticate using JWT from AWS Cognito SendBird -->> WebChat: Authentication successful User ->> WebChat: Enter message "Hello" WebChat ->> BE: Forward message to be processed BE ->> DynamoDB: Store message with status "Pending" BE ->> Bandwidth: POST SMS to +17036089795 note right of Bandwidth: to: +17036089795<br>from: +17866181889<br>text: "Hello" Bandwidth-->> BE: SMS sent notification BE ->> DynamoDB: Update message status to "Sent" BE -->> WebChat: Message sent notification User ->> WebChat: View sent message status note over Bandwidth,User: Later, when a reply comes Bandwidth ->> BE: Incoming SMS from +17036089795 note right of BE: from: +17036089795<br>text: "Hi there!" BE ->> DynamoDB: Store incoming message BE -->> WebChat: Display incoming message User ->> WebChat: View incoming message ``` Here's a breakdown: 1. **User Login and Authentication**: - The user logs into the WebChat or MS Teams interface. - WebChat/MS Teams interface communicates with SendBird to authenticate using JWT (JSON Web Token) which was acquired from AWS Cognito. 2. **Sending an SMS**: - The user sends a message through the WebChat interface. - This message goes to the SendBird backend which then communicates with Bandwidth's API to send the SMS. - API sample for sending an SMS is provided in the right note of Bandwidth in the diagram. 3. **Receiving an SMS**: - When a customer replies to the SMS, Bandwidth's API picks it up. - The incoming message is sent to the SendBird backend, which then pushes the message to the WebChat interface. - The user can then view this incoming message in the chat interface. ## Development Schedule 1. **Day 1**: - ✅Setup the development environment. - ✅Begin integration of AWS Cognito for user authentication. - ✅Setup basic chat interface with SendBird. 2. **Day 2**: - Complete AWS Cognito integration. - ✅Integrate Bandwidth API for SMS communication. - ✅Start on MMS functionality. 3. **Day 3**: - ✅Finish MMS functionality. - ✅Integration tests for SMS/MMS and SendBird chat. - ✅Integrate MS Teams app for business representatives. 4. **Day 4**: - ✅Finalize the UI/UX customizations. - ✅Conduct thorough testing across all platforms. - ✅Deploy to Elastic Beanstalk. - Provide documentation and usage guides. ## Acceptance Criteria 1. Successful user authentication using Single Sign-On. 2. Real-time chat functionality in the web app and MS Teams. 3. Successful sending and receiving of SMS and MMS between business representatives and customers. 4. Messages should be stored in DynamoDB. 5. GDPR compliance verified. 6. Successful deployment to Elastic Beanstalk with no reported errors. ## Modified Webex BandwidthSMSService.java To integrate with Sendbird, you need to utilize the Sendbird SDK or API for Java. The Sendbird SDK will help you handle incoming and outgoing chat messages. In the context of your existing Bandwidth integration: 1. When an SMS comes in via Bandwidth: - The system processes the SMS and sends it to the appropriate user on Sendbird. 2. When a user replies on Sendbird: - The system captures that message and sends it out as an SMS via Bandwidth. **To achieve this, follow these steps**: 1. **Setup Sendbird SDK**: - Add the Sendbird SDK to your `pom.xml` or `build.gradle` file (I'll use Maven as an example): ```xml <dependency> <groupId>com.sendbird.sdk</groupId> <artifactId>sendbird-android-sdk</artifactId> <version>LATEST_VERSION</version> </dependency> ``` 2. **Sendbird Configuration**: ```java import com.sendbird.android.SendBird; import com.sendbird.android.SendBirdException; @Service public class SendbirdService { @Value("${sendbird.appId}") private String sendbirdAppId; @PostConstruct public void init() { SendBird.init(sendbirdAppId, ApplicationContextProvider.getContext()); } } ``` 3. **Handle Incoming SMS and Send to Sendbird**: Add to your existing `BandwidthSMSService`: ```java import com.sendbird.android.BaseChannel; import com.sendbird.android.GroupChannel; import com.sendbird.android.SendBirdException; import com.sendbird.android.UserMessage; ... private void sendToSendbirdChat(String userId, String messageText) { GroupChannel.getChannel(CHANNEL_URL, new GroupChannel.GroupChannelGetHandler() { @Override public void onResult(GroupChannel groupChannel, SendBirdException e) { if (e != null) { log.error("Error fetching Sendbird channel: {}", e.getMessage()); return; } groupChannel.sendUserMessage(messageText, null, null, new BaseChannel.SendUserMessageHandler() { @Override public void onSent(UserMessage userMessage, SendBirdException e) { if (e != null) { log.error("Error sending message to Sendbird: {}", e.getMessage()); return; } } }); } }); } // Adjust your validateNumberAndSendMessage function to include: sendToSendbirdChat(numberToMessageAppMap.getEnterprise().getUserId(), bandwidthMessage.getText()); ``` 4. **Handle Sendbird Reply and Send SMS**: You'll likely set up a webhook in Sendbird to listen for new messages. When received at your application endpoint, you should process and send as SMS. ```java @RestController @RequestMapping("/sendbird") public class SendbirdController { @Autowired private BandwidthSMSService bandwidthSMSService; @PostMapping("/incoming-message") public ResponseEntity handleIncomingSendbirdMessage(@RequestBody SendbirdMessageDto messageDto) { if (messageDto != null) { bandwidthSMSService.sendSMSViaBandwidth(messageDto.getTo(), messageDto.getFrom(), messageDto.getMessageText(), null, null); } return ResponseEntity.ok().build(); } } // Where SendbirdMessageDto is a DTO that you define to capture necessary message information from Sendbird's webhook payload. ``` 5. **Error Handling and Improvements**: - Ensure you have proper error handling in place for any Sendbird exceptions. - Secure your endpoints that interact with Bandwidth and Sendbird. - Adjust the Sendbird integration as per your exact needs. Remember to replace placeholders like `CHANNEL_URL` with your actual values. This integration assumes you're using group channels in Sendbird. Adjust based on your Sendbird implementation (open channels, one-to-one, etc.).

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully