Guest User

Untitled

a guest
Jul 16th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. [BotAuthentication(CredentialProviderType = typeof(MultiCredentialProvider))]
  2. public class RouterController : ApiController
  3. {
  4. static readonly ILog Logger = LogManager.GetLogger("RouterController");
  5.  
  6. public virtual async Task<HttpResponseMessage> Post([FromBody]Activity activity,
  7.  
  8. CancellationToken token)
  9. {
  10. using (var scope = DialogModule.BeginLifetimeScope(Conversation.Container, activity))
  11. {
  12. var connector = scope.Resolve<IConnectorClient>();
  13. var botHandle = activity.GetBodHandle();
  14. //...
  15. }
  16.  
  17. var response = Request.CreateResponse(HttpStatusCode.OK);
  18. return response;
  19. }
  20. }
  21.  
  22.  
  23. public class MultiCredentialProvider : ICredentialProvider {....}
  24.  
  25. public static class Extensions
  26. {
  27. public static string GetBotHandle(this IMessageActivity activity)
  28. {
  29. return activity.Recipient.Id.Split('@').First();
  30. }
  31. }
Add Comment
Please, Sign In to add comment