Skip to content

Instantly share code, notes, and snippets.

View dhinag's full-sized avatar

Dhina dhinag

View GitHub Profile
@dhinag
dhinag / FAQ Template
Last active December 16, 2018 21:06
Portal Web Template to render KB articles in FAQ format.
{% fetchxml KB_Query %}
<fetch version="1.0" mapping="logical">
<entity name="knowledgearticle">
<attribute name="knowledgearticleid" />
<attribute name="title" />
<attribute name="content" />
<order attribute="title" descending="false" />
<filter type="and">
<condition attribute="isrootarticle" operator="eq" value="0" />
</filter>
user=Joe
bot=LulaBot
bot: Hi!
user: yo!
bot: [Typing][Delay=3000]
Greetings!
What would you like to do?
* update - You can update your account
* List - You can list your data
@dhinag
dhinag / run.csx
Created September 15, 2018 19:49
public class BotMessage
{
public string Message { get; set; }
}
public static BotMessage Run(string queueMessage, out BotMessage botMessage, TraceWriter log)
{
botMessage = new BotMessage
{
Message = queueMessage
public class QueueMessage
{
public string ChannelID { get; set; }
public string FromID { get; set; }
public string FromName { get; set; }
public string RecipientID { get; set; }
public string RecipientName { get; set; }
public string ConversationID { get; set; }
public string ServiceURL { get; set; }
public string Alert { get; set; }
@dhinag
dhinag / MessagesController.cs
Last active September 8, 2018 02:38
Sending the status to citizen
/// <summary>
/// The bot is obviously stateless. When we get the message from D365, we need to parse the data to find out which citizen should receive what message on which channel.
/// </summary>
/// <param name="activity"></param>
private void CommunicateMessageToUser(Activity activity)
{
var message = JsonConvert.DeserializeObject<QueueMessage>(((JObject)activity.Value).GetValue("Message").ToString());
//Conversation ID is generally the key in order to reply to the same conversation in the channel.
if(!string.IsNullOrEmpty(message.ConversationID))