Please enable JavaScript to view the comments powered by Disqus. Using Serverless Bot Framework with Salesforce Integration to Build Chatbots





Using Serverless Bot Framework with Salesforce Integration to Build Chatbots



Last updated 23/07/2021

Using Serverless Bot Framework with Salesforce Integration to Build Chatbots

Chatbots are becoming more relevant in the age of information delivery, regardless of the industry. With a serverless architecture framework, chatbots are becoming super easy to develop, which will scale up the chatbot market and reduce time-to-delivery and time-to-market costs. Serverless chatbots have a distinct advantage because they change how the applications are created and maintained. 

What exactly is Serverless?

As defined by DZone, “Serverless architectures, refers to applications that significantly depend on third-party services (knows as Backend-as-a-Service or “BaaS”) or on custom code that’s run in ephemeral containers (Function-as-a-Service or “FaaS”) ”.

Serverless architecture is a framework that allows one to configure the development process according to the business needs. In this process, it enables one to upload personalized code and execute the code when needed without developers having to worry about the complexities of the entire process.  

Does this mean there is no server? No, there are servers. But as an end-user, one doesn’t have to worry about how those servers are spawned, maintained, or scaled. This layer of abstraction lets the end-user configure services on those servers indirectly.

In this blog post, we’ll explore a pre-packaged AWS architect-vetted solution called the Serverless Bot Framework. This is an AWS Solutions Implementation that can be used to add sophisticated conversational chatbots to an existing web or mobile application. It can also be extended to expand the scope of customer support by integrating with the existing Salesforce ecosystem. This chatbot can be customized to enrich customer support with intelligent, self-service, and life-like experiences. In addition, it alleviates the need to engage a CSR.

The Serverless Bot Framework solution uses AWS CloudFormation to automate the deployment of framework architecture into AWS Cloud, as shown in Figure 1.
Serverless Bot Framework architecture

Figure 1. Serverless Bot Framework architecture

Since the latest release of this Framework (v1.5.0), the Solution has integrated Amazon Lex V2 as an option for the brain module of the chatbot. This new integration supports multiple languages in a single bot, the addition of a new language to an existing bot, and other features. The solution also provides a sample web application hosted on Amazon Simple Storage Service (S3) and accessed by Amazon CloudFront. Every interaction comes via Amazon API Gateway and gets synthesized by a core AWS Lambda function. This determines the capable bot microservice that can answer the customer’s question. We call this core process the Intent Resolution Engine. The solution also provides model microservices for weather forecasting, pizza ordering, and appointment scheduling. These microservices showcase the ease of integrating both native AWS services and external API-dependent architectures.

Use Case

Here’s a fictional use case to showcase the value of our solution. Let’s assume there is a government agency that requires its citizens to submit pension/retirement benefit claims using a customer-facing web/mobile application. Say the application stack is built using open-source technologies and persists claims submission-related information in its respective database. It is common for large organizations to have multiple disparate systems that assist in serving their customers. Let’s extend our use case with enterprise-wide data points centralized on Salesforce. It is this internal Salesforce platform that powers the enterprise contact center solution operated by human CSR agents. How can this agency build an interactive chatbot feature on top of their existing pension/retirement application stack? How can they extend that chatbot interactive experience to provide information from other disparate systems? Let’s unpack the Serverless Bot Framework from the AWS Solutions Implementation library and apply it to this use case.

To provide an intelligent self-serve experience to their customers, this agency can use the Serverless Bot Framework’s CloudFormation template to deploy the framework architecture. The API Gateway endpoint can hook this Bot architecture into their existing website/mobile application. The framework comes with built-in Amazon Cognito integration, which can be used for API authentication purposes. For the backend, the existing Amazon Lex2 integration can hook with a custom Lambda function that can pull data from the existing web application database. This framework deployment has built-in code hooks for web-to-API-Gateway and Lambda-to-DB, which can be used as models when tailoring the agency’s implementation. By integrating the frontend hook of API Gateway and the backend hook of custom Lambda function into databases, the agency can immediately start to leverage a sophisticated conversational chatbot. This bot can engage in a life-like chat with its customers. It can respond to questions about pension status, claim history, and any relevant claim-based information.

During these interactions with our chatbot, the customer may ask about information external to the pension/retirement application, but relevant to the government agency. Possible questions are: “What are my unemployment benefits?” or “What are my government-sponsored health benefits?” Assuming this extended information is available in the Salesforce environment, there are two potential options:

  • Option 1: We can route the chatbot conversation transcript to a live agent who has access to this extended information on Salesforce and can address customer questions.
  • Option 2: We can extend our chatbot architecture to dip into the Salesforce data repository and pull relevant information to potentially address customer questions. This is possible by exposing service API(s) from Salesforce for bot consumption.

Obviously, Option 1 has challenges associated with a traditional contact center, such as agent-wait-time, limited availability, and more. Alternatively, Option 2 is much more scalable and efficient. Let’s talk about high-level implementation choices with option 2.


Here are a few architectural considerations this customer can explore to establish connectivity between the AWS infrastructure and Salesforce. The customer can build a dedicated SaaS Integration Service VPC on the AWS side, as described in our Connecting AWS and Salesforce blog post. This architecture uses AWS PrivateLink and establishes an authorization model using the OAuth2.0 framework (leveraging Node.js wrapper nforce). This secures the access/refresh token that can be used for the chatbot Lambda interactions with the Salesforce API. The other architectural option is SSL certificate-based integration between AWS Lambda and the Salesforce Connected App. This uses the OAuth2.0 JSON Web Token (leveraging the new-salesforce-jwt library). This is detailed in an AWSPlatformEventsJWT article by Salesforce developers.

Once the connectivity mechanism is determined between AWS and the Salesforce environments, the lex-sfdc-dip Lambda function can be programmed to make web service calls to Salesforce API endpoints. This is shown in Figure 2. This is used for extended information and to intelligently respond to customer’s questions in real-time. After this customization is in place, our chatbot will be able to provide superior competing levels of support on par with a human CSR.
Notional architecture for Serverless Bot Framework & Salesforce Integration

Figure 2. Notional architecture for Serverless Bot Framework & Salesforce Integration

As you can see, our Serverless Bot Framework can be deployed quickly and is ready to integrate into existing architectures. Although we presented Salesforce integration here, the same conceptual implementation idea can be applied to other heterogeneous platforms. Although the use case we chose is related to a government agency, this API-based Framework solution can bring instant intelligent chatbot results to any industry application.

The serverless nature of the Serverless Bot Framework makes this solution cost-effective as well. Customers only pay for what they use, and it auto-scales for demand spikes. We ran estimates for multiple example scenarios with notional requirements like monthly active users, number of API requests per month and presented the cost breakdown of this solution deployment in our Implementation Guide.


In this post, we explored the option to bring an interactive life-like experience to customers of an existing web/mobile application using the ready-to-deploy Serverless Bot Framework. We also talked about extending this chatbot architecture and providing enterprise-level intelligent self-service features to customers by integrating with a Salesforce environment. Our goal with this blog post is to spark ideas around unique architectural patterns that can be built using the Serverless Bot Framework. We want to show businesses how to tap into richer customer support without the need for any major upgrade to their existing systems.


Topic Related Post

Beyond the certification: Essential skills for landing your dream job as an AWS Solution Architect
Maximizing Efficiency and Minimizing Costs: Essential Strategies for AWS Solutions Architects
Azure Security Best Practices for AZ-104 Certified Professionals

About Author

NovelVista Learning Solutions is a professionally managed training organization with specialization in certification courses. The core management team consists of highly qualified professionals with vast industry experience. NovelVista is an Accredited Training Organization (ATO) to conduct all levels of ITIL Courses. We also conduct training on DevOps, AWS Solution Architect associate, Prince2, MSP, CSM, Cloud Computing, Apache Hadoop, Six Sigma, ISO 20000/27000 & Agile Methodologies.




* Your personal details are for internal use only and will remain confidential.


Upcoming Events


Every Weekend


Every Weekend


Every Weekend


Every Weekend

Topic Related

Take Simple Quiz and Get Discount Upto 50%

Popular Certifications

AWS Solution Architect Associates
SIAM Professional Training & Certification
ITIL® 4 Foundation Certification
DevOps Foundation By DOI
Certified DevOps Developer
PRINCE2® Foundation & Practitioner
ITIL® 4 Managing Professional Course
Certified DevOps Engineer
DevOps Practitioner + Agile Scrum Master
ISO Lead Auditor Combo Certification
Microsoft Azure Administrator AZ-104
Digital Transformation Officer
Certified Full Stack Data Scientist
Microsoft Azure DevOps Engineer
OCM Foundation
SRE Practitioner
Professional Scrum Product Owner II (PSPO II) Certification
Certified Associate in Project Management (CAPM)
Practitioner Certified In Business Analysis
Certified Blockchain Professional Program
Certified Cyber Security Foundation
Post Graduate Program in Project Management
Certified Data Science Professional
Certified PMO Professional
AWS Certified Cloud Practitioner (CLF-C01)
Certified Scrum Product Owners
Professional Scrum Product Owner-II
Professional Scrum Product Owner (PSPO) Training-I
GSDC Agile Scrum Master
ITIL® 4 Certification Scheme
Agile Project Management
FinOps Certified Practitioner certification
ITSM Foundation: ISO/IEC 20000:2011
Certified Design Thinking Professional
Certified Data Science Professional Certification
Generative AI Certification
Generative AI in Software Development
Generative AI in Business
Generative AI in Cybersecurity
Generative AI for HR and L&D
Generative AI in Finance and Banking
Generative AI in Marketing
Generative AI in Retail
Generative AI in Risk & Compliance
ISO 27001 Certification & Training in the Philippines
Generative AI in Project Management
Prompt Engineering Certification
SRE Certification Course
Devsecops Practitioner Certification
AIOPS Foundation Certification
ISO 9001:2015 Lead Auditor Training and Certification
ITIL4 Specialist Monitor Support and Fulfil Certification
SRE Foundation and Practitioner Combo
Generative AI webinar
Leadership Excellence Webinar
Certificate Of Global Leadership Excellence
SRE Webinar
ISO 27701 Lead Auditor Certification
Gen AI for Project Management Webinar
Certified Cloud Tester Foundation
HR Business Partner Certification
Chief Learning Officer Certification