{"id":21359659,"url":"https://github.com/suin/google-cloud-functions-japannetbank-email-parser","last_synced_at":"2025-03-16T06:26:21.571Z","repository":{"id":38174419,"uuid":"282834496","full_name":"suin/google-cloud-functions-japannetbank-email-parser","owner":"suin","description":"この Google Cloud Function はジャパンネット銀行の通知メールをパースし、通知種別ごとにオブジェクトを作り、それを Google Cloud Pub/Sub に publish する半部品です。","archived":false,"fork":false,"pushed_at":"2023-01-06T12:33:25.000Z","size":3492,"stargazers_count":0,"open_issues_count":23,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-22T18:51:48.151Z","etag":null,"topics":["email-automation","google-cloud-functions","google-cloud-pubsub","japannetbank","rpa","serverless"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/suin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-27T08:11:11.000Z","updated_at":"2020-07-27T08:14:56.000Z","dependencies_parsed_at":"2023-02-06T02:15:30.721Z","dependency_job_id":null,"html_url":"https://github.com/suin/google-cloud-functions-japannetbank-email-parser","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suin%2Fgoogle-cloud-functions-japannetbank-email-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suin%2Fgoogle-cloud-functions-japannetbank-email-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suin%2Fgoogle-cloud-functions-japannetbank-email-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suin%2Fgoogle-cloud-functions-japannetbank-email-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suin","download_url":"https://codeload.github.com/suin/google-cloud-functions-japannetbank-email-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243835400,"owners_count":20355601,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["email-automation","google-cloud-functions","google-cloud-pubsub","japannetbank","rpa","serverless"],"created_at":"2024-11-22T05:29:17.908Z","updated_at":"2025-03-16T06:26:21.548Z","avatar_url":"https://github.com/suin.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @suin/google-cloud-functions-japannetbank-email-parser\n\nこの Google Cloud Function はジャパンネット銀行の通知メールをパースし、通知種別ごとにオブジェクトを作り、それを Google Cloud Pub/Sub に publish する半部品です。\n\nジャパンネット銀行の通知メールのパースは、[@suin/japannetbank-email-parser](https://github.com/suin/japannetbank-email-parser) が行います。対応している通知についてはそちらを御覧ください。\n\n## アーキテクチャ\n\n![](https://i.imgur.com/JFh9GNv.jpg)\n\n所定のトピックにメールデータを入れると、`publishJapannetbankNotificationOnEmail`関数がそれを処理し、「ジャパンネット銀行通知オブジェクト」を別のトピックに publish します。\n\n## セットアップ\n\n### Email Hook のシステムを構築する\n\nこのパッケージは半部品なので、メールを受信する機構が含まれていません。GCP の Pub/Sub のトピックに積まれたメールデータを処理するだけです。したがって、メールを受信してそのトピックにメールデータを publish するシステムは別途用意する必要があります。\n\nEmail Hook を実現するパッケージとしては、以下の半部品パッケージを組み合わせてください:\n\n- [suin/google-cloud-functions-sendgrid-inbound-parse: This package is a backend for SendGrid Inbound Parse. It runs on Google Cloud Platform Functions. It receives the form data from SendGrid and publishes an EmailData event to GCP Pub/Sub.](https://github.com/suin/google-cloud-functions-sendgrid-inbound-parse)\n- [suin/google-cloud-functions-email-router: A Google Cloud Function that routes EmailData](https://github.com/suin/google-cloud-functions-email-router)\n\nなお、メール受信用トピックのデータは[EventData](https://github.com/suin/event-data/blob/master/index.ts#L3) \u003c [EmailData](https://github.com/suin/email-data/blob/master/index.ts#L25) \u003eのオブジェトを `JSON.stringify` したものであれば良いので、上記の半部品パッケージを使わなくても構いません。お好みで。\n\n### ジャパンネット銀行の my m@ail を有効化する\n\nジャパンネット銀行の[メール通知サービス my m@il](https://www.japannetbank.co.jp/service/account/mail/index.html) を有効化し、メール通知を受け取れるようにします。\n\n### GCP にデプロイする\n\nデプロイするには[./deploy.sh](./deploy.sh)を実行してください。トピック名のカスタマイズが必要な場合は、このファイルを変更してください。\n\n```bash\n./deploy.sh\n```\n\n## 動作テスト\n\nこのパッケージ単体での動作確認は、次の手順で行うことができます。\n\n```bash\n# デバッグ用のサブスクリプションを作る\ngcloud pubsub subscriptions create --topic 'japannetbankNotification' testDrive\n\n# メールデータを入れる\ngcloud pubsub topics publish 'test%40example.com' --message '{\"correlationId\":\"dummy\",\"data\":{\"to\":[],\"cc\":[],\"replyTo\":[],\"subject\":\"【Ｖｉｓａデビット】ご利用代金お引き落としのお知らせ\",\"from\":[],\"bodyText\":\"いつもジャパンネット銀行をご利用いただきありがとうございます。\\n\\nJNB Visaデビットのご利用代金を普通預金口座よりお引き落としいたしました。\\nお引落日時：2001/02/03 04:05:06\\nお引落金額：2,760円\\n加盟店名：ＡＭＡＺＯＮ　ＣＯ　ＪＰ\\n取引明細番号：1A165002\\n\\n[...略...]\"}}'\n\n# 関数によってpublishされたデータを確認する\ngcloud pubsub subscriptions pull testDrive \\\n    --format=\"flattened(ackId,message.messageId,message.publishTime,message.attributes,message.data.decode(base64).encode(utf-8))\" \\\n    --limit=10 \\\n    --auto-ack\n\n# 掃除\ngcloud pubsub subscriptions delete testDrive\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuin%2Fgoogle-cloud-functions-japannetbank-email-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuin%2Fgoogle-cloud-functions-japannetbank-email-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuin%2Fgoogle-cloud-functions-japannetbank-email-parser/lists"}