SlideShare a Scribd company logo
BOT FRAMEWORK AND XAMARIN.FORMS APPLICATION INTEGRATION
USING
DIRECT LINE CLIENT API
+
BRYAN ANTHONY GARCIA
• Works at Avanade
• Mobile Developer
• Xamarin.Forms, UWP, HoloLens, Web, and Azure solutions
• Graphic Designer
Your Speaker
Direct Line API
CLIENT APPLICATIONS
DIRECT LINE CLIENT
API
BOT
Authorization
Direct Line API RESTful Interface
Create
Conversation
Send Message Get Reply
Refresh
Conversation
Authentication – Secret and Token
Secret
• Application-wide key to secure the direct line channel.
• Can access any conversation, and create tokens. Secrets do not expire.
Token
• Optional
• Conversation-specific key.
• Tokens expire in 30 minutes, but can be refreshed.
Response:
HTTP/1.1 200 OK
RCurR_XV9ZA.cwA.BKA.iaJrC8xpy8qbOF5xnR2vtCX7CZj0LdjAPGfiCpg8qbOF5xPGfiCpg4Fv0y8qqbxn - TOKEN
Authentication –W Secrets and Tokens
Request:
POST directline.botframework.com/api/tokens/conversations
Authorization: [BotConnector or Bearer] <secret key here>
This operation is optional. Use this step if you want to prevent clients from accessing
conversations they aren't participating in.
directline.botframework.com routes your client to the nearest datacenter.
This is the best option if you do not know where your client is located.
asia.directline.botframework.com routes only to Direct Line servers in Eastern Asia.
europe.directline.botframework.com routes only to Direct Line servers in Europe.
northamerica.directline.botframework.com routes only to Direct Line servers in North America.
Geographic Direct Line endpoints
Use Geographic-specific endpoints to ensure your traffic ends up in exactly the right
datacenter. A great way to avoid sending your packets on an accidental trans-Atlantic or
trans-Pacific journey!
Response:
{
"conversationId": "abc123",
"token“ :
"RCurR_XV9ZA.cwA.BKA.iaJrC8xpy8qbOF5xnR2vtCX7CZj0LdjAPGfiCpg4Fv0y8qbOF5xPGfiCpg4Fv0y8qqbOF5x8qbOF5xn",
"expires_in": 1800
}
Create Conversation
Request:
POST directline.botframework.com/api/conversations/
Authorization: [BotConnector or Bearer] <secret key or token here>
Direct Line conversations are explicitly opened by clients and may run as long as the bot
and client participate (and have valid credentials. More than one client may connect to a
given conversation. If successful, the Direct Line service replies with a JSON object
containing a conversation ID and a token.
Response:
HTTP/1.1 204 No Content
Send Message
Request:
POST directline.botframework.com/api/conversations/<conversationId>/messages
Authorization: [BotConnector or Bearer] <secret key or token here>
{ "text": "hello",
"from": "user1“ }
No data is returned in this call. If the bot generates an error, that error will trigger an HTTP
500 error in the POST /api/conversations/{conversationId}/messages call.
Response:
{
"messages": [{ "conversation": "abc123", "id": "abc123|0000", "text": "hello", "from": "user1" }, {
"conversation": "abc123", "id": "abc123|0001", "text": "Nice to see you, user1!", "from": "bot1" }],
"watermark": "000002“
}
Get Bot Replies
Request:
GET directline.botframework.com/api/conversations/<conversationId>/messages
Authorization: [BotConnector or Bearer] <secret key or token here>
Clients issue GET calls to the /api/conversations/{conversationId}/messages endpoint to
get all messages inside the conversation. Optionally supply a watermark indicating the
most recent message seen.
Response:
HTTP/1.1 200 OK
Refresh Conversation
Request:
GET directline.botframework.com/api/tokens/{conversationId}/renew
Authorization: [BotConnector or Bearer] <secret key or token here>
Conversations or tokens are valid for 30 minutes from the time they are generated.
Cannot be refreshed if it’s already expired.
Prism MVVM
https://github.com/PrismLibrary/Prism
An MVVM framework for building loosely coupled, maintainable, and testable XAML
applications in WPF, Windows 10 UWP, and Xamarin Forms.
Xamarin Plugins
https://github.com/xamarin/XamarinComponents
Collection of open source components (including bindings and plugins) created by
Xamarin and others in the community.

More Related Content

PDF
Bot Framework with Xamarin Forms
PDF
Building an SSO platform in php (Zendcon 2010)
PPT
Linkedin & OAuth
PDF
Introduction to OAuth 2.0 - Part 2
PPTX
Chatbot development with Microsoft Bot Framework
PPTX
Introduction to OAuth 2.0 - Part 1
PDF
OAuth2 and LinkedIn
PPTX
OAuth Authorization flows in salesforce
Bot Framework with Xamarin Forms
Building an SSO platform in php (Zendcon 2010)
Linkedin & OAuth
Introduction to OAuth 2.0 - Part 2
Chatbot development with Microsoft Bot Framework
Introduction to OAuth 2.0 - Part 1
OAuth2 and LinkedIn
OAuth Authorization flows in salesforce

What's hot (20)

PDF
Introduction to OAuth 2.0 - Part 1
PPTX
Sys02 best way to create a share point app
PPTX
Setting up your ring central sandbox in steps
PDF
S4 line business platform
PPTX
Creating a Sign On with Open id connect
PPTX
Use Xamarin.Forms and surprise your customers when develop native apps, in le...
PPTX
Integration of linked in using mule esb
PPTX
Integrate facebook using mule esb
PDF
Text Deck Case Study
PDF
Authentication with OAuth and Connected Apps
PPTX
Mule ESB integration with Stripe
PPT
Easy Web Serivce on iOS with Pico
PPTX
A simple PHP LinkedIn OAuth 2.0 example
PPTX
Mule esb stripe
PPT
Open Id, O Auth And Webservices
KEY
LinkedIn OAuth: Zero To Hero
PPTX
Creating & consuming simple web service
PDF
Chatbot Meetup
PDF
Creating cloud ready enterprise applications with the sharepoint 2013 app model
PDF
Azure bot service
Introduction to OAuth 2.0 - Part 1
Sys02 best way to create a share point app
Setting up your ring central sandbox in steps
S4 line business platform
Creating a Sign On with Open id connect
Use Xamarin.Forms and surprise your customers when develop native apps, in le...
Integration of linked in using mule esb
Integrate facebook using mule esb
Text Deck Case Study
Authentication with OAuth and Connected Apps
Mule ESB integration with Stripe
Easy Web Serivce on iOS with Pico
A simple PHP LinkedIn OAuth 2.0 example
Mule esb stripe
Open Id, O Auth And Webservices
LinkedIn OAuth: Zero To Hero
Creating & consuming simple web service
Chatbot Meetup
Creating cloud ready enterprise applications with the sharepoint 2013 app model
Azure bot service
Ad

Similar to DirectLineAPI - Xamarin.Forms App and Bot Framework Integration (12)

PDF
Line Messaging API Integration with Spring-Boot
PDF
Enabling Voice Applications with WebRTC and ORTC in Microsoft Edge
PDF
Matrix.org decentralised communication, Matthew Hodgson, TADSummit
PPT
Building a bot with an intent
PDF
AWS Lambda Hands-on: How to Create Phone Call Notifications in a Serverless W...
PDF
AWS Lambda Hands-on: How to Create Phone Call Notifications in a Serverless Way
PDF
Create a Bot with Delphi and Telegram - ITDevCon 2016
PPTX
Real time voice call integration - Confoo 2012
PPTX
From ZERO to REST in an hour
PPT
Alin miu google app engine(gae) v1.1
PDF
Matrix - One-year in, Matthew Hodgson, Matrix.org
PDF
Taming Cloud APIs with Swift
Line Messaging API Integration with Spring-Boot
Enabling Voice Applications with WebRTC and ORTC in Microsoft Edge
Matrix.org decentralised communication, Matthew Hodgson, TADSummit
Building a bot with an intent
AWS Lambda Hands-on: How to Create Phone Call Notifications in a Serverless W...
AWS Lambda Hands-on: How to Create Phone Call Notifications in a Serverless Way
Create a Bot with Delphi and Telegram - ITDevCon 2016
Real time voice call integration - Confoo 2012
From ZERO to REST in an hour
Alin miu google app engine(gae) v1.1
Matrix - One-year in, Matthew Hodgson, Matrix.org
Taming Cloud APIs with Swift
Ad

Recently uploaded (20)

PPTX
A Presentation on Artificial Intelligence
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Electronic commerce courselecture one. Pdf
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPT
Teaching material agriculture food technology
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
cuic standard and advanced reporting.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Modernizing your data center with Dell and AMD
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
KodekX | Application Modernization Development
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Unlocking AI with Model Context Protocol (MCP)
A Presentation on Artificial Intelligence
NewMind AI Monthly Chronicles - July 2025
Electronic commerce courselecture one. Pdf
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Teaching material agriculture food technology
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Building Integrated photovoltaic BIPV_UPV.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
cuic standard and advanced reporting.pdf
Encapsulation_ Review paper, used for researhc scholars
MYSQL Presentation for SQL database connectivity
Modernizing your data center with Dell and AMD
“AI and Expert System Decision Support & Business Intelligence Systems”
KodekX | Application Modernization Development
NewMind AI Weekly Chronicles - August'25 Week I
Mobile App Security Testing_ A Comprehensive Guide.pdf
The AUB Centre for AI in Media Proposal.docx
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Network Security Unit 5.pdf for BCA BBA.
Unlocking AI with Model Context Protocol (MCP)

DirectLineAPI - Xamarin.Forms App and Bot Framework Integration

  • 1. BOT FRAMEWORK AND XAMARIN.FORMS APPLICATION INTEGRATION USING DIRECT LINE CLIENT API +
  • 2. BRYAN ANTHONY GARCIA • Works at Avanade • Mobile Developer • Xamarin.Forms, UWP, HoloLens, Web, and Azure solutions • Graphic Designer Your Speaker
  • 3. Direct Line API CLIENT APPLICATIONS DIRECT LINE CLIENT API BOT
  • 4. Authorization Direct Line API RESTful Interface Create Conversation Send Message Get Reply Refresh Conversation
  • 5. Authentication – Secret and Token Secret • Application-wide key to secure the direct line channel. • Can access any conversation, and create tokens. Secrets do not expire. Token • Optional • Conversation-specific key. • Tokens expire in 30 minutes, but can be refreshed.
  • 6. Response: HTTP/1.1 200 OK RCurR_XV9ZA.cwA.BKA.iaJrC8xpy8qbOF5xnR2vtCX7CZj0LdjAPGfiCpg8qbOF5xPGfiCpg4Fv0y8qqbxn - TOKEN Authentication –W Secrets and Tokens Request: POST directline.botframework.com/api/tokens/conversations Authorization: [BotConnector or Bearer] <secret key here> This operation is optional. Use this step if you want to prevent clients from accessing conversations they aren't participating in.
  • 7. directline.botframework.com routes your client to the nearest datacenter. This is the best option if you do not know where your client is located. asia.directline.botframework.com routes only to Direct Line servers in Eastern Asia. europe.directline.botframework.com routes only to Direct Line servers in Europe. northamerica.directline.botframework.com routes only to Direct Line servers in North America. Geographic Direct Line endpoints Use Geographic-specific endpoints to ensure your traffic ends up in exactly the right datacenter. A great way to avoid sending your packets on an accidental trans-Atlantic or trans-Pacific journey!
  • 8. Response: { "conversationId": "abc123", "token“ : "RCurR_XV9ZA.cwA.BKA.iaJrC8xpy8qbOF5xnR2vtCX7CZj0LdjAPGfiCpg4Fv0y8qbOF5xPGfiCpg4Fv0y8qqbOF5x8qbOF5xn", "expires_in": 1800 } Create Conversation Request: POST directline.botframework.com/api/conversations/ Authorization: [BotConnector or Bearer] <secret key or token here> Direct Line conversations are explicitly opened by clients and may run as long as the bot and client participate (and have valid credentials. More than one client may connect to a given conversation. If successful, the Direct Line service replies with a JSON object containing a conversation ID and a token.
  • 9. Response: HTTP/1.1 204 No Content Send Message Request: POST directline.botframework.com/api/conversations/<conversationId>/messages Authorization: [BotConnector or Bearer] <secret key or token here> { "text": "hello", "from": "user1“ } No data is returned in this call. If the bot generates an error, that error will trigger an HTTP 500 error in the POST /api/conversations/{conversationId}/messages call.
  • 10. Response: { "messages": [{ "conversation": "abc123", "id": "abc123|0000", "text": "hello", "from": "user1" }, { "conversation": "abc123", "id": "abc123|0001", "text": "Nice to see you, user1!", "from": "bot1" }], "watermark": "000002“ } Get Bot Replies Request: GET directline.botframework.com/api/conversations/<conversationId>/messages Authorization: [BotConnector or Bearer] <secret key or token here> Clients issue GET calls to the /api/conversations/{conversationId}/messages endpoint to get all messages inside the conversation. Optionally supply a watermark indicating the most recent message seen.
  • 11. Response: HTTP/1.1 200 OK Refresh Conversation Request: GET directline.botframework.com/api/tokens/{conversationId}/renew Authorization: [BotConnector or Bearer] <secret key or token here> Conversations or tokens are valid for 30 minutes from the time they are generated. Cannot be refreshed if it’s already expired.
  • 12. Prism MVVM https://github.com/PrismLibrary/Prism An MVVM framework for building loosely coupled, maintainable, and testable XAML applications in WPF, Windows 10 UWP, and Xamarin Forms.
  • 13. Xamarin Plugins https://github.com/xamarin/XamarinComponents Collection of open source components (including bindings and plugins) created by Xamarin and others in the community.