Skip to content

Instantly share code, notes, and snippets.

View andz88's full-sized avatar

Andre K Margono andz88

View GitHub Profile
public async Task<HttpResponseMessage> Post([FromBody]Activity activity)
{
if (activity.Type == ActivityTypes.Message)
{
// Initiates the form flow
await Conversation.SendAsync(activity, MakeRootDialog);
}
else
{
HandleSystemMessage(activity);
using CrmChatBot.CRM;
using CrmChatBot.Model;
using Microsoft.Bot.Builder.Dialogs;
using Microsoft.Bot.Builder.Luis;
using Microsoft.Bot.Builder.Luis.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using CrmChatBot.CRM;
using CrmChatBot.Model;
using Microsoft.Bot.Builder.Dialogs;
using Microsoft.Bot.Builder.FormFlow;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace CrmChatBot.FormFlow
public static void CreateTestDrive(TestDriveDetail testDrive, IOrganizationService crmService)
{
var lead = new Microsoft.Xrm.Sdk.Entity(EntityName);
//lead.Attributes
lead.Attributes.Add(Field_Subject, $"Test Drive Request by {testDrive.CustomerName}");
lead.Attributes.Add(Field_FirstName, testDrive.CustomerName);
lead.Attributes.Add(Field_Description, $@"Test drive request summary:
{Environment.NewLine}Car Make: {testDrive.CarMake},
{Environment.NewLine}Car Model: {testDrive.CarModel},
{Environment.NewLine}Requested Time: {testDrive.RequestedTime},
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using Microsoft.Bot.Builder.Dialogs;
using Microsoft.Bot.Connector;
using System.Text.RegularExpressions;
using CrmChatBot.Model;
using CrmChatBot.CRM;
namespace CrmChatBot.Model
{
[Serializable]
public class TestDriveDetail
{
public string CarMake { get; set; }
public string CarModel { get; set; }
public string RequestedTime { get; set; }
public string CustomerName { get; set; }
public string PhoneNumber { get; set; }
[BotAuthentication]
public class MessagesController : ApiController
{
/// <summary>
/// POST: api/Messages
/// Receive a message from a user and reply to it
/// </summary>
public async Task<HttpResponseMessage> Post([FromBody]Activity activity)
{
if (activity.Type == ActivityTypes.Message)