Skip to content

Conversation

@jsalwen
Copy link

@jsalwen jsalwen commented May 22, 2017

#15 add support for template tag to Facebook for botkit

  • add dashbotTemplateId in botkitTransformOutgoing
  • add addTemplateTag method
  • update example on usage

Calling addTemplateTag will queue up a template tag to be added to the next message logged to Dashbot

* add dashbotTemplateId in botkitTransformOutgoing
* add addTemplateTag method
* update example on usage
@jsalwen
Copy link
Author

jsalwen commented May 23, 2017

@jhullfly I tried adding the dashbotTemplateId to botkit message object, but all non-facebook properties are stripped out.

If you have a better approach, let me know, and I will update PR and test.

@techno246
Copy link

@jsalwen My approach was to add the dashbotTemplateId in the message object, and in the botkitTransformOutgoing(bot, message) method, use the getAndRemove method like for the channel object. Seems to work well.

  function botkitTransformOutgoing(bot, message) {
    var sendMessage = _.cloneDeep(message);
    var channel = getAndRemove(sendMessage, 'channel');
    var templateTagId = getAndRemove(sendMessage, 'dashbotTemplateId');
    return {
      qs: {
        access_token: bot.botkit.config.access_token
      },
      json: {
        dashbotTemplateId: templateTagId,
        recipient: {
          id: channel
        },
        message: sendMessage
      }
    };
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants