# IG Page Subscription ### 問題 Background 1. 目前 UI Design 那邊是走 curator 的模式,連結粉專與 ig 帳號還有授權,如果要做到一樣,那似乎是要研究 facebook SDK 2. webhook 訂閱項目需要 FB app,但是 curator 似乎沒有 FB app 就能做到,不確定是不是跟第三步驟的授權選項有關係 3. 如果一個 FB app 只能設定一個 webhook endpoint,那會有一個 sponsor 使用單一 FB app 開兩檔活動的可能 4. 承 3. 若是這個 case 取消訂閱的話就會變成兩個活動都一起取消? --- ### Facebook App :point_right: 訂閱的設定是在 FB app 上完成,若要讓訂閱可以順利自動化,必須串接 facebook api - 多個 FB App - sponsor level - 一個 sponsor 可以有一個 fb app 那就代表可以有多組 webhook endpoint - 取消訂閱只會影響該 sponsor 的所有活動 - 取消訂閱只能作在程式架構裡,無法使用 facebook 提供的 api - promotion level - 每個 promotion 可以有自己的 fb app ,且都可以有自己對應的 webhook endpoint - 取消訂閱只會影響該檔服務,可直接使用 facebook 提供的 api - 有提交審核的問題 - 由誰建立? 客戶/RD/業務 - hookdeck 可以 sponsor or promotion 為單位建立 connection - hookdeck 可以 transformer 為後續的 api 提供參數方便查找 promotion - 一個 FB App - 只能設定一組 webhook endpoint - 使用 hookdeck 的理由薄弱,不能完全避免流量問題 - hookdeck 無法使用 transformer 為後續的 api 提供參數以查找 promotion --- ### Sponsor Fan Page/IG account 設定 - 未來會不會有多個 IG 帳號舉辦活動的需求 - 有的話,目前最新提議是我們將設定放在 Sponsor setting。以這樣的使用指向性而言,模組切換或新增舉辦 IG 帳號時需要穿插在編輯器與Soponsor setting - 沒有的話,未來面臨這樣膨脹的需求有什麼代償機制嗎,或是保留未來開發的彈性。 --- - 切換 IG 帳號建立新IG活動時,已建立的活動會受影響 (IG 相關 API 會需要 account 的 access token ) --- ### 2022/07/13 meeting memo - old platform rules - one sponsor bind one page - new platform - due to change of login method, so account will not connected to facebook - record token in backend - [user deletes subscribed apps](https://developers.facebook.com/docs/graph-api/reference/page/subscribed_apps/#Deleting) ### flow of IG module - create promotion - check wheather IG binding to FB or not - if no, go to binding - store user's information - user token - page token - IG account ID - page ID - check all need information no problem - subcribe IG webhook ( when ?) - system in active mode - promotion end - unsubscribe IG webhook - judge all promotion end ### detail of handle hash tag - redis key - IgAccountID_hashCode - hash(tag1 + tag2 + tag3) ### Question what happend when subscribe twice? winfred: after test its a update when to subscribe? when promotion "test" or "online" when to unsubsribe? use cronjob to find condition that match bellow current datetime > last promotion endtime of specific sponsor - 20220718 - dev IG promotion enddate over size - when to cancel webhook subcribe - not reply private message when promotion end - not review when promotion end - prefer to 7 day when promotion end - redis management - attend promotion - reply DM - judge message process or not - private DM link design must - unique - not hacked - can be general? or IG only - most important 2 things - url token design - webhook subscribe management # webhook subscribe management 訂閱管理 * 粉絲頁 IG webhook 訂閱 * create promotion settings key : unsubscribeInstagramWebhookAt (以下簡稱取消訂閱時間) 1. 訂閱時機 * 按下測試按鈕產生測試連結時 * 取消訂閱時間 = current timestamp + 3 day * 按下上線按鈕 * 取消訂閱時間 = promotion EndDate 2. 取消訂閱時機 * cronjob * 逐一 sponsor 下所有活動取出 "取消訂閱時間" 最大值 3. Q&A * cronjob 執行時間 跟 "取消訂閱時間" 存在時間差問題。 solution A: 拉高 cronjob 執行頻率。 * 按下上線按鈕當下,webhook 已開啟訂閱,若活動開始時間還沒到的話,開啟訂閱時間跟活動開始時間,也會有時間差問題。 solution A: ------------------------- ## 20220726 1. 用不同 user token 會取得一樣的 page token 嗎? 2. 測試 / 上線 訂閱,可限制開始時間於 _ 內才准許上線,縮短訂閱跟活動開始時間的時間差。 3. user token & page token - 偏好於 sponsor level ,重新授權不用再一一進編輯器。 4. 告知 PM ,webhook mention event 會因為例外錯誤、活動狀態、授權 token 失效,導致該次 event lost。 ------ 1. mention event 需儲存以確保不丟失資料。 2. 私訊關鍵字 -> 同 sponsor下活動需唯一 3. sponsor setting ig name ? (Calvin) 4. 推廣工具 - story mention * sponsor promotion hashtag * sponsor story mention without promotion * story mention unique by sponosor 5. sponsor setting - page token / user token expire day
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up