botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

[Feature Request] Add support for Facebook Message Tags

Open iMicknl opened this issue 9 years ago • 22 comments

Adding a Message Tag allows you to send it outside the 24+1 window, for a limited number of use cases (shipping update, reservations, and issue resolution), per Messenger Platform policy.

Documentation

System Information (Required)

  • SDK Language: Node.js
  • SDK Version: 3.8.4

Issue Description

Since Facebook decided that the 'tag' should be outside of the 'message' object, it isn't possible to add this tag using Message.sourceEvent. This is quite an important feature for the Facebook Messenger channel since it allows you to send users a proactive message after 24 hours.

Expected Behavior

{
  "recipient": { 
    "id": "USER_ID"
  },
  "message":{
    ...
  },
  "tag": "SHIPPING_UPDATE"
}

Actual Results

{
  "recipient": { 
    "id": "USER_ID"
  },
  "message":{
      "tag": "SHIPPING_UPDATE"
  }
}

iMicknl avatar Jun 10 '17 21:06 iMicknl

We also need this feature and if possible a way to tag the conversation from the webchat component. Also, if anyone has a workaround for this, please let us know.

Thank you.

ancashoria avatar Jun 22 '17 09:06 ancashoria

Please let us know if anyone has any news about it, because we need it. Thank you!

andreiciungan avatar Jun 22 '17 10:06 andreiciungan

Facebook just added 5 extra Message Tags in an update of the Messenger Platform. At the moment this is a huge limitation of the Bot Framework for more advanced bots on Facebook, since you can't send users a message anymore after the 24+1 window.

Any idea if this is on the Bot Framework roadmap (@nwhitmont)?

iMicknl avatar Jul 31 '17 19:07 iMicknl

Hello, do you have any news about this feature request? Thanks

ancashoria avatar Sep 18 '17 07:09 ancashoria

Any updates or a work-around? This is quite a blocker for proactive messages on Facebook, since it isn't possible for most usecases without this Message Tag..

Facebook just announced more new Message Tags (https://messenger.fb.com/blog/3-new-tags-now-available-for-customer-messaging/).

iMicknl avatar Oct 04 '17 17:10 iMicknl

Unfortunately no update at this time. Feel free to check back periodically, good luck!

JasonSowers avatar Oct 04 '17 18:10 JasonSowers

Any updates or a work-around? +1

yiutsunchan avatar Oct 30 '17 04:10 yiutsunchan

I found how to add a tag using C#

var activity = (Activity)message;
activity.Properties = new Newtonsoft.Json.Linq.JObject();
activity.Properties.Add("tag", "APPLICATION_UPDATE");

ma3yta avatar Jan 09 '18 18:01 ma3yta

@Ma3yTa Have you tested it? how do you know it works?

etbuilder avatar Jan 23 '18 15:01 etbuilder

@etbuilder I tested it and it works as expected because I got approvement for proactive messages from Facebook. They give this approvement only if you have any tag in a payload. https://developers.facebook.com/docs/messenger-platform/send-messages/message-tags

ma3yta avatar Jan 23 '18 15:01 ma3yta

Can someone from Microsoft (@JasonSowers ) confirm this is the right place in C# to implement message tags?

etbuilder avatar Jan 24 '18 07:01 etbuilder

@etbuilder due to Microsoft you can use ChannelData to implement channel specific functionality https://docs.microsoft.com/en-us/bot-framework/dotnet/bot-builder-dotnet-channeldata . I didn't try to use ChannelData because overriding properties using Properties works for me.

ma3yta avatar Jan 24 '18 07:01 ma3yta

Hi, is there any update on this? @Ma3yTa are you sure you’re not just getting it to work by using subscription messaging? You’re code above doesn’t work for me. See my comment on this issue #4154.

Thanks

stuprice avatar Mar 06 '18 21:03 stuprice

@stuprice it works for me. Try to use just this two lines without setting ChannelData

var activity = (Activity)message;
activity.Properties = new Newtonsoft.Json.Linq.JObject();
activity.Properties.Add("tag", "APPLICATION_UPDATE");

ma3yta avatar Mar 06 '18 21:03 ma3yta

https://developers.facebook.com/docs/messenger-platform/send-messages/message-tags

ma3yta avatar Mar 06 '18 22:03 ma3yta

Hi, thanks for your reply. I've tried the code above and it still doesn't work for me. I've posted the full details on Stack Overflow, would you mind having a look?

How to Set Facebook Message Tag

Thanks

stuprice avatar Mar 07 '18 09:03 stuprice

@stuprice I posted code of class which I use for proactive messages on stack overflow https://stackoverflow.com/a/49148650/5113846 .

ma3yta avatar Mar 07 '18 09:03 ma3yta

Is there any solution for Node.js? It would be great if a don’t need to migrate all my session.send lines to native FB messages and add the new property...

advl03 avatar Mar 18 '18 16:03 advl03

I'm testing a solution for Node.js versión based on a middleware. What I do for each reply message is the following: send: (event: BotBuilder.IEvent, next: Function) => { if (event.source === 'facebook') { event.sourceEvent.messaging_type = 'RESPONSE'; } next(); } I do not receive any error from FB platform, but I'm not sure if the message is sent including the new field. Do you know where I can see the final format of the request sent to FB API?

advl03 avatar Mar 27 '18 07:03 advl03

@advl03 Viewing the message sent by the connector services to FB Api is not currently a feature.

Closing this issue. Messenger feature requests are tracked here: https://github.com/Microsoft/BotBuilder/issues/4360 (I've referenced this one there)

EricDahlvang avatar Aug 17 '18 18:08 EricDahlvang