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

What's hot (20)

PDF
Introduction to OAuth 2.0 - Part 1
Nabeel Yoosuf
 
PPTX
Sys02 best way to create a share point app
DotNetCampus
 
PPTX
Setting up your ring central sandbox in steps
Anirban Sen Chowdhary
 
PDF
S4 line business platform
LINE Corporation
 
PPTX
Creating a Sign On with Open id connect
Derek Binkley
 
PPTX
Use Xamarin.Forms and surprise your customers when develop native apps, in le...
Paulo Cesar Ortins Brito
 
PPTX
Integration of linked in using mule esb
Sanjeet Pandey
 
PPTX
Integrate facebook using mule esb
Sanjeet Pandey
 
PDF
Text Deck Case Study
BlueVia
 
PDF
Authentication with OAuth and Connected Apps
Salesforce Developers
 
PPTX
Mule ESB integration with Stripe
Ramakrishna Narkedamilli
 
PPT
Easy Web Serivce on iOS with Pico
William Yang
 
PPTX
A simple PHP LinkedIn OAuth 2.0 example
Mattia Reggiani
 
PPTX
Mule esb stripe
D.Rajesh Kumar
 
PPT
Open Id, O Auth And Webservices
Myles Eftos
 
KEY
LinkedIn OAuth: Zero To Hero
Taylor Singletary
 
PPTX
Creating & consuming simple web service
Abhijit B.
 
PDF
Chatbot Meetup
Luca Bianchi
 
PDF
Creating cloud ready enterprise applications with the sharepoint 2013 app model
InnoTech
 
PDF
Azure bot service
Ian Chen
 
Introduction to OAuth 2.0 - Part 1
Nabeel Yoosuf
 
Sys02 best way to create a share point app
DotNetCampus
 
Setting up your ring central sandbox in steps
Anirban Sen Chowdhary
 
S4 line business platform
LINE Corporation
 
Creating a Sign On with Open id connect
Derek Binkley
 
Use Xamarin.Forms and surprise your customers when develop native apps, in le...
Paulo Cesar Ortins Brito
 
Integration of linked in using mule esb
Sanjeet Pandey
 
Integrate facebook using mule esb
Sanjeet Pandey
 
Text Deck Case Study
BlueVia
 
Authentication with OAuth and Connected Apps
Salesforce Developers
 
Mule ESB integration with Stripe
Ramakrishna Narkedamilli
 
Easy Web Serivce on iOS with Pico
William Yang
 
A simple PHP LinkedIn OAuth 2.0 example
Mattia Reggiani
 
Mule esb stripe
D.Rajesh Kumar
 
Open Id, O Auth And Webservices
Myles Eftos
 
LinkedIn OAuth: Zero To Hero
Taylor Singletary
 
Creating & consuming simple web service
Abhijit B.
 
Chatbot Meetup
Luca Bianchi
 
Creating cloud ready enterprise applications with the sharepoint 2013 app model
InnoTech
 
Azure bot service
Ian Chen
 

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

PDF
Line Messaging API Integration with Spring-Boot
InnovationM
 
PDF
Enabling Voice Applications with WebRTC and ORTC in Microsoft Edge
Mark Roberts
 
PDF
Matrix.org decentralised communication, Matthew Hodgson, TADSummit
Alan Quayle
 
PPT
Building a bot with an intent
Abhishek Sur
 
PDF
AWS Lambda Hands-on: How to Create Phone Call Notifications in a Serverless W...
CodeOps Technologies LLP
 
PDF
AWS Lambda Hands-on: How to Create Phone Call Notifications in a Serverless Way
Srushith Repakula
 
PDF
Create a Bot with Delphi and Telegram - ITDevCon 2016
Marco Breveglieri
 
PPTX
Real time voice call integration - Confoo 2012
Michael Peacock
 
PPTX
From ZERO to REST in an hour
Cisco DevNet
 
PPT
Alin miu google app engine(gae) v1.1
Google Developer Group Bucharest
 
PDF
Matrix - One-year in, Matthew Hodgson, Matrix.org
Alan Quayle
 
PDF
Taming Cloud APIs with Swift
Tim Burks
 
Line Messaging API Integration with Spring-Boot
InnovationM
 
Enabling Voice Applications with WebRTC and ORTC in Microsoft Edge
Mark Roberts
 
Matrix.org decentralised communication, Matthew Hodgson, TADSummit
Alan Quayle
 
Building a bot with an intent
Abhishek Sur
 
AWS Lambda Hands-on: How to Create Phone Call Notifications in a Serverless W...
CodeOps Technologies LLP
 
AWS Lambda Hands-on: How to Create Phone Call Notifications in a Serverless Way
Srushith Repakula
 
Create a Bot with Delphi and Telegram - ITDevCon 2016
Marco Breveglieri
 
Real time voice call integration - Confoo 2012
Michael Peacock
 
From ZERO to REST in an hour
Cisco DevNet
 
Alin miu google app engine(gae) v1.1
Google Developer Group Bucharest
 
Matrix - One-year in, Matthew Hodgson, Matrix.org
Alan Quayle
 
Taming Cloud APIs with Swift
Tim Burks
 
Ad

Recently uploaded (20)

PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
Ad

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.