-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinpireme.csx
28 lines (24 loc) · 841 Bytes
/
inpireme.csx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//this should be a gist, but....
//any way drop this into your azure function:
using System.Net;
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
{
log.Info("C# HTTP trigger function processed a request.");
var inspirobotUrl = "http://inspirobot.me/api?generate=true";
// call inspiro got to get the image url
string resultContent = "";
using(var client = new HttpClient())
{
var result = await client.GetAsync(inspirobotUrl);
resultContent = await result.Content.ReadAsStringAsync();
log.Info(resultContent);
}
return req.CreateResponse(
HttpStatusCode.OK,
new {
response_type = "in_channel",
attachments = new []{
new {image_url = resultContent }
}}
);
}