###前提・実現したいこと
AzureFunctionにてC#でLINEBotを作成しています。
LINE MessagingAPIで、Reply APIを使用して送られてきたリクエストからroomId/groupIdを取得したいのですが、失敗します。
(最終的には取得したroomId/groupIdを使用してPostAPIからルームにPOSTしようとしています)
どなたか取得方法をご教示いただけませんでしょうか。
###発生している問題・エラーメッセージ
以下のようなエラーとなり取得できません。
error CS1061: 'Source' does not contain a definition for 'groupId' and no extension method 'groupId' accepting a first argument of type 'Source' could be found (are you missing a using directive or an assembly reference?)
###該当のソースコード
cs
1public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log) 2{ 3 // リクエストJSONをパース 4 string jsonContent = await req.Content.ReadAsStringAsync(); 5 Request data = JsonConvert.DeserializeObject<Request>(jsonContent); 6 7 // リクエストデータからデータを取得 8 foreach (var item in data.events) 9 { 10 var userId = item.source.roomId.ToString();//←ここで取得したい 11 12//以下略
###試したこと
ルームだけではなくグループにも参加させてitem.source.groupId.ToString()
を試しましたが同じでした。
1対1の会話で試しましたがitem.source.userId.ToString()
で問題なく取得できました。
###補足情報(言語/FW/ツール等のバージョンなど)
上記ソースでitem.source.type.ToString()
の取得結果は「room」でした。
あなたの回答
tips
プレビュー