How to send broadcast message using webhook in dialogflow.ai , in c# - c#

I'm creating a bot using dialogflow ( api.ai ) and webhook in c# using visual studio.
I have to create the option of broadcast message for all the user who has request to be subscribe.
When user call intent subscribe , i call the action : subscribe.about where i save psid .
The code below :
public ApiAiResponse Post([FromBody]JObject jsonRequest)
{
using (WebhookReceiverModelDataContext ctx = new
WebhookReceiverModelDataContext())
{
ApiAiRequest request = jsonRequest.ToObject<ApiAiRequest>();
ApiAiResponse response = new ApiAiResponse();
JObject jObject =
JObject.Parse(request.result.parameters.ToString());
if ("subscribe.about".Equals(request.result.action.ToLower()))
{
using (WebhookReceiverModelDataContext cts = new
WebhookReceiverModelDataContext())
{
string messageabout = request.result.resolvedQuery != null ? request.result.resolvedQuery : "";
speechLang = "You are subscribed";
source = "Broadcast";
}
}
I have to create a module to send broadcast message to all this users in the moment that the event will be online .
I have in a table stored data like : Id, Event Name , Event Date
When : Event Date = now => i have to send the message all this users which are subscribed.
I start to use proactive message , but seems that they are created using botframework . I want to use only the webhook .
I created a controller to send message in facebook , but seems not OK :
I got this message when i call this controller :
<Error>
<Message>An error has occurred.</Message>
</Error>
namespace WebhookReceiver.Controllers
{
public class WebhookController : ApiController
{
string pageToken = "xxxxxxx";
string appSecret = "yyyyy";
public HttpResponseMessage Get()
{
var querystrings = Request.GetQueryNameValuePairs().ToDictionary(x
=> x.Key, x => x.Value);
if (querystrings["hub.verify_token"] == "zzzzz")
{
return new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent(querystrings["hub.challenge"],
Encoding.UTF8, "text/plain")
};
}
return new HttpResponseMessage(HttpStatusCode.Unauthorized);
}
[HttpPost]
public async Task<HttpResponseMessage> Post()
{
var signature = Request.Headers.GetValues("X-Hub-
Signature").FirstOrDefault().Replace("sha1=", "");
var body = await Request.Content.ReadAsStringAsync();
if (!VerifySignature(signature, body))
return new HttpResponseMessage(HttpStatusCode.BadRequest);
var value = JsonConvert.DeserializeObject<WebhookModel>(body);
if (value._object != "page")
return new HttpResponseMessage(HttpStatusCode.OK);
foreach (var item in value.entry[0].messaging)
{
if (item.message == null && item.postback == null)
continue;
else
await SendMessage(GetMessageTemplate(item.message.text,
item.sender.id));
}
return new HttpResponseMessage(HttpStatusCode.OK);
}
private bool VerifySignature(string signature, string body)
{
var hashString = new StringBuilder();
using (var crypto = new HMACSHA1(Encoding.UTF8.GetBytes(appSecret)))
{
var hash = crypto.ComputeHash(Encoding.UTF8.GetBytes(body));
foreach (var item in hash)
hashString.Append(item.ToString("X2"));
}
return hashString.ToString().ToLower() == signature.ToLower();
}
/// <summary>
/// get text message template
/// </summary>
/// <param name="text">text</param>
/// <param name="sender">sender id</param>
/// <returns>json</returns>
private JObject GetMessageTemplate(string text, string sender)
{
return JObject.FromObject(new
{
recipient = new { id = sender },
message = new { text = text }
});
}
/// <summary>
/// send message
/// </summary>
/// <param name="json">json</param>
private async Task SendMessage(JObject json)
{
using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Accept.Add(new
MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage res = await
client.PostAsync($"https://graph.facebook.com/v2.6/me/messages?
access_token={pageToken}", new StringContent(json.ToString(),
Encoding.UTF8,
"application/json"));
}
}
}
}
How can i create this module please . I need some advises . Using postman i have test to send message in by bot using API call of Facebook . I'm new in c# so please help me :(

Related

Get all emails from Oulook using GgraphServiceClient api

I want all emails from outlook with date filter and if has attachment.
GraphServiceClient _graphServiceClient = new GraphServiceClient(
new DelegateAuthenticationProvider((requestMessage) =>
{
requestMessage.Headers.Authorization = new AuthenticationHeaderValue("bearer", externalUserLogin.AccessToken);
return Task.FromResult(0);
}));
IUserMessagesCollectionPage pagedMessages;
var queryOptions = new List<QueryOption>()
{
new QueryOption("ReceivedDateTime", $"2022-01-01..2022-10-12"),
new QueryOption("hasattachment", "true")
};
pagedMessages = await _graphServiceClient.Me.Messages
.Request(queryOptions)
.Select(msg => new
{
msg.Subject,
msg.BodyPreview,
msg.ReceivedDateTime,
msg.HasAttachments,
msg.Attachments,
msg.Id
})
.Expand("attachments")
.Top(50)
.OrderBy("receivedDateTime desc")
.GetAsync();
foreach (var item in pagedMessages.CurrentPage)
{
if (item.Attachments != null && item.Attachments.Any())
{
foreach (var attachment in item.Attachments)
{
if (attachment.ODataType == "#microsoft.graph.fileAttachment")
{
FileAttachment fileAttachment = attachment as FileAttachment;
byte[] contentBytes = fileAttachment.ContentBytes;
}
}
}
}
I already tried, but the filter is not working as expected. I got all emails with attachment and without attachment.
I want all emails without take.
I added ".Expand("attachments")", So I have to call the attachment API separately or I get attachments?
if your trying to use $search as a Query option then your code isn't correct it should be
var queryOptions = new List<QueryOption>()
{
new QueryOption("$search", $"received>=2022-01-01 AND received<=2022-10-12 AND hasattachment:true"),
};
the KQL keyword for is ReceivedDateTime is received https://learn.microsoft.com/en-us/microsoft-365/compliance/keyword-queries-and-search-conditions?view=o365-worldwide while the between ... operator should be supported I think its discouraged and didn't work for me (although i have used it in the past in EWS)
Finally I got the solutions. I am getting all the emails using Filter. I used query options, but it is not working. Below is complete solutions for is read, has attachment, filter by date and update email after inserting your local db.
/// <summary>
/// Gets a mail from Outlook
/// </summary>
/// <param name="token">Token</param>
/// <returns></returns>
public async Task<IList<Message>> GetEMails(string token)
{
IUserMessagesCollectionPage pagedMessages;
List<Message> emailMessages = new List<Message>();
GraphServiceClient _graphServiceClient = new GraphServiceClient(
new DelegateAuthenticationProvider((requestMessage) =>
{
requestMessage.Headers.Authorization = new AuthenticationHeaderValue("bearer", token);
return Task.FromResult(0);
}));
pagedMessages = await _graphServiceClient.Me.Messages
.Request()
.Filter($"ReceivedDateTime ge 2022-01-01 and receivedDateTime lt 2022-01-31 and hasAttachments eq true and isRead eq false")
.Select(msg => new
{
msg.Body,
msg.Subject,
msg.BodyPreview,
msg.ReceivedDateTime,
msg.Attachments,
msg.Id,
msg.CcRecipients,
msg.BccRecipients,
msg.From,
msg.ToRecipients
})
.Expand("attachments")
.Top(10)
.OrderBy("receivedDateTime desc")
.GetAsync();
emailMessages.AddRange(pagedMessages.CurrentPage);
while (pagedMessages.NextPageRequest != null)
{
pagedMessages = await pagedMessages.NextPageRequest.GetAsync();
emailMessages.AddRange(pagedMessages.CurrentPage);
}
return messages;
}
/// <summary>
/// Update is Message Mark as Read
/// </summary>
/// <param name="id">Message ID</param>
/// <param name="_graphServiceClient">Graph Service Client</param>
/// <returns></returns>
private async Task MarkAsRead(string id, GraphServiceClient _graphServiceClient)
{
try
{
await _graphServiceClient.Me
.Messages[id]
.Request()
.Select("IsRead")
.UpdateAsync(new Message { IsRead = true });
}
catch (Exception ex)
{
_customLogger.Error(ex.Message, ex);
}
}

Connection reset issue in .net core api call (net::ERR_CONNECTION_RESET 200 (OK))

I have a .net core API service which is called from a angular client project.
When a user request a status of his payment, we will make call to this service api and this service will then call a payment gateway service to fetch the status of payment and the output result will return to the user.
When i try to integrate this i am facing this below error.
net::ERR_CONNECTION_RESET 200 (OK)
core.js:5967 ERROR Unknown Error
This above issue is not showing when i try to hit the service after putting one breakpoint. Its also returning the result.
This is how entire flow works
Client side call performs by user
this.dataservice.postFeed(method, JSON.stringify(this.initsearch)).subscribe(result => {
var response = result.body["data"];
console.log(response);
});
Server side code looks like
[HttpPost]
public async Task<IActionResult> Post([FromBody] ObjectModel searchValue)
{
ApiResponse<string> response = new ApiResponse<string>();
IBaseResult<string> result = await _adlerBo.GetPaymentStatus(searchValue);
response.Success = result.success;
response.Data = result.Data;
return Ok(response);
}
In BusinessObject.cs
public async Task<IBaseResult<string>> GetPaymentStatus(PaymentSearchModel requestModel){
string apiResponse = await PaymentStatusCheckUsingAPI(requestModel.orderid);
return apiResponse ;
}
private async Task<string> PaymentStatusCheckUsingAPI(string orderNumber)
{
string message = await PostPaymentRequestToGateway(statusApiUrl, authQueryUrlParam);
NameValueCollection param = await GetResponseMap(message);
string status = "";
string encResJson = "";
if (param != null && param.Count == 2)
{
for (int i = 0; i < param.Count; i++)
{
if ("status".Equals(param.Keys[i]))
{
status = param[i];
}
if ("enc_response".Equals(param.Keys[i]))
{
encResJson = param[i];
}
}
if (!"".Equals(status) && status.Equals("0"))
{
resJson = crypto.Decrypt(encResJson, workingKey);
}
else if (!"".Equals(status) && status.Equals("1"))
{
Console.WriteLine("failure response: " + encResJson);
}
}
return resJson;
}
private async Task<string> PostPaymentRequestToGateway(string queryUrl, string urlParam)
{
string message = "";
try
{
StreamWriter myWriter = null;// it will open a http connection with provided url
WebRequest objRequest = WebRequest.Create(queryUrl);//send data using objxmlhttp object
objRequest.Method = "POST";
//objRequest.ContentLength = TranRequest.Length;
objRequest.ContentType = "application/x-www-form-urlencoded";//to set content type
myWriter = new System.IO.StreamWriter(objRequest.GetRequestStream());
myWriter.Write(urlParam);//send data
myWriter.Close();//closed the myWriter object
// Getting Response
System.Net.HttpWebResponse objResponse = (System.Net.HttpWebResponse)objRequest.GetResponse();//receive the responce from objxmlhttp object
using (System.IO.StreamReader sr = new System.IO.StreamReader(objResponse.GetResponseStream()))
{
message = await sr.ReadToEndAsync();
//Response.Write(message);
}
}
catch (Exception exception)
{
Console.Write("Exception occured while connection." + exception);
}
return message;
}
private async Task<NameValueCollection> GetResponseMap(string message)
{
//await Task.Delay(2000); I did this with no Luck
NameValueCollection Params = new NameValueCollection();
if (message != null || !"".Equals(message))
{
string[] segments = message.Split('&');
foreach (string seg in segments)
{
string[] parts = seg.Split('=');
if (parts.Length > 0)
{
string Key = parts[0].Trim();
string Value = parts[1].Trim();
Params.Add(Key, Value);
}
}
}
return await Task.FromResult(Params);
}
Any idea how to fix this? Why its working when i put breakpoint and not otherwise.
Am i doing correct asynchronous implimentsion in my api?

Lead Ads Testing Tool - Server failure (102)

I'm trying to get Facebook leadgen ad data.
1-)As seen below, facebook sends the data to me successfully and I receive it successfully.
Successful Process img
2-)But the submissions I made on just this page do not come. What could be the reason for this?
Failed Process img
*But only the opinions I made on this page are not coming. What could be the reason for this?
Facebook doesn't even post. As seen in the picture, Server failure (102) information is displayed. What is the reason of this?
3-)The code I received the incoming data
Asp.Net Api Method
public async Task<HttpResponseMessage> Post([FromBody] JsonData data)
{
try
{
dbmanager db = new dbmanager();
db.Jsonkaydetv2(data);
var entry = data.Entry.FirstOrDefault();
var change = entry?.Changes.FirstOrDefault();
if (change == null) return new HttpResponseMessage(HttpStatusCode.BadRequest);
//Generate user access token here https://developers.facebook.com/tools/accesstoken/
const string token = "XXXX";
var leadUrl = $"https://graph.facebook.com/v2.10/{change.Value.LeadGenId}?access_token={token}";
var formUrl = $"https://graph.facebook.com/v2.10/{change.Value.FormId}?access_token={token}";
using (var httpClientLead = new HttpClient())
{
var response = await httpClientLead.GetStringAsync(formUrl);
if (!string.IsNullOrEmpty(response))
{
var jsonObjLead = JsonConvert.DeserializeObject<LeadFormData>(response);
db.JsonkaydetLeadFormData(jsonObjLead);
//jsonObjLead.Name contains the lead ad name
//Jsonkaydet(jsonObjLead.Name+"x");
//If response is valid get the field data
using (var httpClientFields = new HttpClient())
{
var responseFields = await httpClientFields.GetStringAsync(leadUrl);
if (!string.IsNullOrEmpty(responseFields))
{
var jsonObjFields =JsonConvert.DeserializeObject<LeadData(responseFields);
db.JsonkaydetLeadData(jsonObjFields);
//jsonObjFields.FieldData contains the field value
}
}
}
}
return new HttpResponseMessage(HttpStatusCode.OK);
}
catch (Exception ex)
{
Jsonkaydet(ex.ToString());
Trace.WriteLine($"Error-->{ex.Message}");
Trace.WriteLine($"StackTrace-->{ex.StackTrace}");
return new HttpResponseMessage(HttpStatusCode.BadGateway);
}
}

Get messages which contain an attachment via gmail API

I'm building an app based on the Gmail API. I can see all messages from the current inbox, but I need to limit this to only messages which have an attachment. How can I do this?
This is my GoogleController.cs:
[HttpGet]
[Authorize]
public async Task<IActionResult> GetListEmail(string LabelId, string nameLabel)
{
string UserEmail = User.FindFirst(c => c.Type == ClaimTypes.Email).Value;
var service = GetService();
List<My_Message> listMessages = new List<My_Message>();
List<Message> result = new List<Message>();
var emailListRequest = service.Users.Messages.List(UserEmail);
emailListRequest.LabelIds = LabelId;
emailListRequest.IncludeSpamTrash = false;
emailListRequest.MaxResults = 1000;
var emailListResponse = await emailListRequest.ExecuteAsync();
if (emailListResponse != null && emailListResponse.Messages != null)
{
foreach (var email in emailListResponse.Messages)
{
var emailInfoRequest = service.Users.Messages.Get(UserEmail, email.Id);
var emailInfoResponse = await emailInfoRequest.ExecuteAsync();
if (emailInfoResponse != null)
{
My_Message message = new My_Message();
message.Id = listMessages.Count + 1;
message.EmailId = email.Id;
foreach (var mParts in emailInfoResponse.Payload.Headers)
{
if (mParts.Name == "Date")
message.Date_Received = mParts.Value;
else if (mParts.Name == "From")
message.From = mParts.Value;
else if (mParts.Name == "Subject")
message.Title = mParts.Value;
}
listMessages.Add(message);
}
}
}
ViewBag.Message = nameLabel;
return View("~/Views/Home/Index.cshtml", listMessages);
}
I think a simpler solution would be to query in the Users.messages.list endpoint without the need to create filters.
You can actually use the parameter q to make a query like you would in the GMail searchbox, if not familiar you can look at the whole list of operators.
In fact there is an example to make use of this query parameter in the documentation:
using Google.Apis.Gmail.v1;
using Google.Apis.Gmail.v1.Data;
using System.Collections.Generic;
// ...
public class MyClass {
// ...
/// <summary>
/// List all Messages of the user's mailbox matching the query.
/// </summary>
/// <param name="service">Gmail API service instance.</param>
/// <param name="userId">User's email address. The special value "me"
/// can be used to indicate the authenticated user.</param>
/// <param name="query">String used to filter Messages returned.</param>
public static List<Message> ListMessages(GmailService service, String userId, String query)
{
List<Message> result = new List<Message>();
UsersResource.MessagesResource.ListRequest request = service.Users.Messages.List(userId);
request.Q = query; // inform this with the right query
do
{
try
{
ListMessagesResponse response = request.Execute();
result.AddRange(response.Messages);
request.PageToken = response.NextPageToken;
}
catch (Exception e)
{
Console.WriteLine("An error occurred: " + e.Message);
}
} while (!String.IsNullOrEmpty(request.PageToken));
return result;
}
// ...
}
So for your case you just need to add the line
emailListRequest.Q = "has:attachment";
before executing the request, doing like this will not create a whole filter for your account, so maybe it's more convenient for your case.
use a filter with criteria like this => criteria.query="has:attachment"
see also here => https://developers.google.com/gmail/api/v1/reference/users/settings/filters#resource
For testing any filter you can use GMail:
image

Authorization for Microsoft App ID xxx failed with status code Forbidden and reason phrase 'Forbidden'

My bot keeps failing on the following line of code with the error in Skype, WebChat, and FB chat. I've tried entering the MS App ID and password via the app settings and the web.config. This works fine in the emulator without any errors. When I ran remote debugging I found that this fails on Webchat, Skype, and FB messenger at this line of code:
await connector.Conversations.ReplyToActivityAsync(reply1);
My bot is integrated with SmartThings so the smart accessories are turning on and off as expected but the response back that should be returned in the chat seems to be failing. I've tried creating a new bot service app but it fails as well.
Update including all code:
using System;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http;
using Microsoft.Bot.Connector;
using System.Net.Http.Headers;
using System.Threading;
using Microsoft.IdentityModel.Protocols;
using System.Configuration;
namespace FirstBotApp
{
[BotAuthentication]
public class Switches
{
public string name { get; set; }
public string value { get; set; }
}
public class MessagesController : ApiController
{
static HttpClient client = new HttpClient();
static HttpResponseMessage responsemain = null;
static int j = 0;
static void ShowSwitches(Switches[] switches)
{
for (int i = switches.Length - 1; i >= 0; i--)
{
Console.WriteLine($"Name: {switches[i].name}\tPrice: {switches[i].value}\t");
}
return;
}
static async Task<Switches[]> GetSwitchesAsync(string path)
{
Switches[] switches = null;
responsemain = await client.GetAsync(path);
//Console.WriteLine(client.GetAsync(path));
//Console.WriteLine(response);
if (responsemain.IsSuccessStatusCode)
{
//Console.WriteLine($"Successful response: {response.StatusCode}");
var response1 = await client.GetStringAsync("");
Console.WriteLine($"{response1}");
switches = await responsemain.Content.ReadAsAsync<Switches[]>();
//JObject j = JObject.Parse(response1);
}
else Console.WriteLine($"Error in response: {responsemain.StatusCode}");
return switches;
}
static async Task<Switches> UpdateSwitchesAsync(Switches switches)
{
Console.WriteLine("Turning off the light");
HttpResponseMessage response = await client.PutAsJsonAsync($"switches/off?room=LivingRoom", switches);
response.EnsureSuccessStatusCode();
Console.WriteLine($"The response from the server was: {response.StatusCode}");
// Deserialize the updated switches from the response body.
switches = await response.Content.ReadAsAsync<Switches>();
Thread.Sleep(10000);
Console.WriteLine($"Turning on the light");
response = await client.PutAsJsonAsync($"switches/on?room=LivingRoom", switches);
Console.WriteLine($"The response from the server was: {response.StatusCode}");
Thread.Sleep(10000);
return switches;
}
static async Task<HttpStatusCode> DeleteSwitchesAsync(string id)
{
HttpResponseMessage response = await client.DeleteAsync($"api/switchess/{id}");
return response.StatusCode;
}
/// <summary>
/// POST: api/Messages
/// Receive a message from a user and reply to it
/// </summary>
public async Task<HttpResponseMessage> Post([FromBody]Activity activity)
{
Switches[] switches = null;
ConnectorClient connector = new ConnectorClient(new Uri(activity.ServiceUrl));
//string appdId = AppSettings.Settings["MicrosoftAppId"];
//string appPassword = ConfigurationManager.AppSettings["MicrosoftAppPassword"];
if (j == 0)
{
//client.Timeout = TimeSpan.FromSeconds(4);
//Declaration of client and Switches variable
string accessToken = "xxxxx";
client.BaseAddress = new Uri("xxxxx");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + accessToken);
j++;
//client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue ("Authorization", "Bearer " + accessToken);
}
if (activity.Type == ActivityTypes.Message)
{
//, appdId, appPassword);
//Switches switches = new Switches;
Activity reply1;// = activity.CreateReply($"breakpoint1");
//await connector.Conversations.ReplyToActivityAsync(reply1);
switch (activity.Text.ToLower())
{
case"turn on livingroom":
try
{
Console.WriteLine("Turning on the light");
responsemain = await client.PutAsJsonAsync($"switches/on?room=LivingRoom", switches);
responsemain.EnsureSuccessStatusCode();
//Console.WriteLine($"The response from the server was: {responsemain.StatusCode}");
// Deserialize the updated product from the response body.
switches = await responsemain.Content.ReadAsAsync<Switches[]>();
reply1 = activity.CreateReply($"Successfully turned on LivingRoom Light");
await connector.Conversations.ReplyToActivityAsync(reply1);
}
catch
{
reply1 = activity.CreateReply($"Error");
await connector.Conversations.ReplyToActivityAsync(reply1);
}
break;
case "turn off livingroom":
try
{
Console.WriteLine("Turning off the light");
responsemain = await client.PutAsJsonAsync($"switches/off?room=LivingRoom", switches);
responsemain.EnsureSuccessStatusCode();
Console.WriteLine($"The response from the server was: {responsemain.StatusCode}");
// Deserialize the updated product from the response body.
switches = await responsemain.Content.ReadAsAsync<Switches[]>();
reply1 = activity.CreateReply($"Successfully turned off LivingRoom Light");
await connector.Conversations.ReplyToActivityAsync(reply1);
}
catch
{
reply1 = activity.CreateReply($"Error");
await connector.Conversations.ReplyToActivityAsync(reply1);
}
break;
default: //"What lights are on?":
try
{
switches = await GetSwitchesAsync("");
//Console.WriteLine($"About to show the product");
ShowSwitches(switches);
//await connector.Conversations.ReplyToActivityAsync(switches[].ToString);
for (int i = switches.Length - 1; i >= 0; i--)
{
reply1 = activity.CreateReply($"Room: ");//{switches[i].name}\tStatus: {switches[i].value}\t");
responsemain.EnsureSuccessStatusCode();
await connector.Conversations.ReplyToActivityAsync(reply1);
}
break;
}
catch
{
}
break;
}
// calculate something for us to return
//int length = (activity.Text ?? string.Empty).Length;
// return our reply to the user
//Activity reply = activity.CreateReply($"You sent {activity.Text} which was {length} characters");
//await connector.Conversations.ReplyToActivityAsync(reply);
}
else
{
HandleSystemMessage(activity);
}
// var response = Request.CreateResponse(HttpStatusCode.OK);
return responsemain;
}
static Activity HandleSystemMessage(Activity message)
{
if (message.Type == ActivityTypes.DeleteUserData)
{
// Implement user deletion here
// If we handle user deletion, return a real message
}
else if (message.Type == ActivityTypes.ConversationUpdate)
{
// Handle conversation state changes, like members being added and removed
// Use Activity.MembersAdded and Activity.MembersRemoved and Activity.Action for info
// Not available in all channels
}
else if (message.Type == ActivityTypes.ContactRelationUpdate)
{
// Handle add/remove from contact lists
// Activity.From + Activity.Action represent what happened
}
else if (message.Type == ActivityTypes.Typing)
{
// Handle knowing tha the user is typing
}
else if (message.Type == ActivityTypes.Ping)
{
}
return null;
}``
//client.dispose();
}
}
I found the error after some additional troubleshooting with remote debugging. Based on #JimLewallen's response I looked closer at the "Credentials" portion of the connector object. The OAuthScope for version 3.0 of the Botframework (connector-> Credentials->OAuthScope in the locals of the remote debugger) was pointing to api.botframework.com/.default when it should have been pointing at "graph.microsoft.com/.default". When I created a new bot service application in Visual Studios using the bot template the OAuthScope showed the correct endpoint.
Incorrect Value:
OAuthScope "api.botframework.com/.default"
Correct Value: Image from the Remote Debugger showing the correct OAuthScope

Categories