diff --git a/handlers/instagram/instagram.go b/handlers/instagram/instagram.go index fab5ab6be..1cdea4a2e 100644 --- a/handlers/instagram/instagram.go +++ b/handlers/instagram/instagram.go @@ -71,23 +71,6 @@ type igUser struct { ID string `json:"id"` } -// { -// "object":"instagram", -// "entry":[{ -// "id":"180005062406476", -// "time":1514924367082, -// "messaging":[{ -// "sender": {"id":"1630934236957797"}, -// "recipient":{"id":"180005062406476"}, -// "timestamp":1514924366807, -// "message":{ -// "mid":"mid.$cAAD5QiNHkz1m6cyj11guxokwkhi2", -// "text":"65863634" -// } -// }] -// }] -// } - type moPayload struct { Object string `json:"object"` Entry []struct { @@ -298,22 +281,6 @@ func (h *handler) receiveEvent(ctx context.Context, channel courier.Channel, w h return events, courier.WriteDataResponse(ctx, w, http.StatusOK, "Events Handled", data) } -// { -// "messaging_type": "" -// "recipient":{ -// "id":"" -// }, -// "message":{ -// "text":"hello, world!" -// "attachment":{ -// "type":"image", -// "payload":{ -// "url":"http://www.messenger-rocks.com/image.jpg", -// "is_reusable":true -// } -// } -// } -// } type mtPayload struct { MessagingType string `json:"messaging_type"` Tag string `json:"tag,omitempty"` @@ -351,7 +318,7 @@ func (h *handler) SendMsg(ctx context.Context, msg courier.Msg) (courier.MsgStat payload := mtPayload{} // set our message type - if msg.ResponseToID() != courier.NilMsgID { + if msg.ResponseToExternalID() != "" { payload.MessagingType = "RESPONSE" } else if topic != "" { payload.MessagingType = "MESSAGE_TAG" diff --git a/handlers/instagram/instagram_test.go b/handlers/instagram/instagram_test.go index 0d891554d..648a3ed68 100644 --- a/handlers/instagram/instagram_test.go +++ b/handlers/instagram/instagram_test.go @@ -369,7 +369,7 @@ var defaultSendTestCases = []ChannelSendTestCase{ {Label: "Plain Response", Text: "Simple Message", URN: "instagram:12345", - Status: "W", ExternalID: "mid.133", ResponseToID: 23526, + Status: "W", ExternalID: "mid.133", ResponseToExternalID: "23526", ResponseBody: `{"message_id": "mid.133"}`, ResponseStatus: 200, RequestBody: `{"messaging_type":"RESPONSE","recipient":{"id":"12345"},"message":{"text":"Simple Message"}}`, SendPrep: setSendURL},