LoginSignup
2
0

Chatwork / Teams Webhook APIの通知内容

Last updated at Posted at 2020-10-29

Chatwork Webhook APIに呼び出されたAzureFunctionsが認識する事項

sample.json
{
    "method": "POST",
    "url": "(FunctionsのURL)?chatwork_webhook_signature=(xxxxx)",
    "originalUrl": "(FunctionsのURL)?chatwork_webhook_signature=(xxxxx)&code=(Functionsの認証コード)",
    "headers": {
        "connection": "Keep-Alive",
        "content-length": "324",
        "content-type": "application/json",
        "host": "(FunctionsのHost)",
        "max-forwards": "9",
        "user-agent": "ChatWork-Webhook/0.1.0-SNAPSHOT",
        "x-chatworkwebhooksignature": "(querystringのxxxxxと同じ)",
        "x-waws-unencoded-url": "(FunctionsのPath)?chatwork_webhook_signature=(xxxxx)&code=(Functionsの認証コード)",
        "client-ip": "xxx.xxx.xxx.xxx:xxxxx",
        "x-arr-log-id": "llllllllllllllll",
        "x-site-deployment-id": "(Functionsの名称)",
        "was-default-hostname": "(FunctionsのHost)",
        "x-original-url": "(ヘッダー、x-waws-unencoded-urlと同じ?)",
        "x-forwarded-for": "xxx.xxx.xxx.xxx:xxxxx",
        "x-arr-ssl": "2048|256|C=US, S=Washington, L=Redmond, O=Microsoft Corporation, OU=Microsoft IT, CN=Microsoft IT TLS CA 5|CN=*.azurewebsites.net",
        "x-forwarded-proto": "https",
        "x-appservice-proto": "https",
        "x-forwarded-tlsversion": "1.2",
        "disguised-host": "(FunctionsのHost)"
    },
    "query": {
        "chatwork_webhook_signature": "(xxxxx)",
        "code": "(Functionsの認証コード)"
    },
    "params": {},
    "body": {
        "webhook_setting_id": "xxxx",
        "webhook_event_type": "message_created",
        "webhook_event_time": 1603899475,
        "webhook_event": {
            "message_id": "mmmmmmmmmmmmmmm",
            "room_id": nnnnnn,
            "account_id": uuuuu,
            "body": "(チャット本文)",
            "send_time": 1603899474,
            "update_time": 0
        }
    },
    "rawBody": "(上記bodyの生データ)"
}

Teams (Azure Bot Service) Webhook で通知される内容

sample.json
{
  "method": "POST",
  "url": "(azure functions の URL)",
  "originalUrl": "(azure functions の URL)",
  "headers": {
    "host": "(azure functions の URL Host部)",
    "user-agent": "Microsoft-SkypeBotApi (Microsoft-BotFramework/3.0)",
    "authorization": "...",
    "content-type": "application/json; charset=utf-8",
    "max-forwards": "9",
    "traceparent": "00-f8812041bb13e065581c513e998dfc60-4a9c7d286fafcda0-00",
    "content-length": "1054",
    "x-ms-conversation-id": "(conversatio_id)",
    "x-ms-tenant-id": "(tenant_id)",
    "ms-cv": "yr6zPJILlkO5wFKi3XHVSg.1.1.1.85432872.1.1",
    "x-arr-log-id": "39449adb-5221-4c89-8ad1-d66ac8aade56",
    "client-ip": "XXX.XXX.XXX.XXX:49143",
    "x-client-port": "9088",
    "x-site-deployment-id": "()",
    "was-default-hostname": "(azure functions の HOST)",
    "x-forwarded-proto": "https",
    "x-appservice-proto": "https",
    "x-arr-ssl": "2048|256|CN=Microsoft Azure TLS Issuing CA 01, O=Microsoft Corporation, C=US|CN=*.azurewebsites.net, O=Microsoft Corporation, L=Redmond, S=WA, C=US",
    "x-forwarded-tlsversion": "1.2",
    "x-client-ip": "YYY.YYY.YYY.YYY",
    "x-forwarded-for": "YYY.YYY.YYY.YYY:9088",
    "x-original-url": "/api/debug?code=(token)",
    "x-waws-unencoded-url": "/api/debug?code=(token)",
    "disguised-host": "(azure functions の URL Host部)"
  },
  "query": {
    "code": "(token)"
  },
  "params": {},
  "body": {
    "text": "(メッセージ本文)",
    "textFormat": "plain",
    "attachments": [
      {
        "contentType": "text/html",
        "content": "<p>Hello, Stagin 5!</p>"
      }
    ],
    "type": "message",
    "timestamp": "2024-01-22T04:46:26.9162656Z",
    "localTimestamp": "2024-01-22T13:46:26.9162656+09:00",
    "id": "(なんかのid)",
    "channelId": "msteams",
    "serviceUrl": "(応答を送りつけるエンドポイント)",
    "from": {
      "id": "(from_id)",
      "name": "小澤 浩一",
      "aadObjectId": "(aadObjectId)"
    },
    "conversation": {
      "conversationType": "personal",
      "tenantId": "(tenant_id)",
      "id": "(conversation_id)"
    },
    "recipient": {
      "id": "(reipient_id)",
      "name": "Smartばんにゃ"
    },
    "entities": [
      {
        "locale": "en-US",
        "country": "US",
        "timezone": "Asia/Tokyo",
        "type": "clientInfo"
      }
    ],
    "channelData": {
      "tenant": {
        "id": "(tenant_id)"
      }
    },
    "locale": "en-US",
    "localTimezone": "Asia/Tokyo"
  },
  "rawBody": "(上記bodyの生データ)"
}
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0