Open gijo-varghese opened 6 years ago
As this component loads the FB sdk for you, I guess you can just use the FB
global object to do so. Maybe you can try it on our example.
@tw0517tw How can I know whether FB is properly bind in window? This is what I've tried:
import PropTypes from "prop-types";
import React from "react";
import MessengerSendToMessenger from "react-messenger-send-to-messenger";
const StmBox = props => (
<div>
<MessengerSendToMessenger
appId="123"
ctaText={props.ctaText}
pageId={props.pageId}
size="xlarge"
/>
</div>
);
FB.Event.subscribe("send_to_messenger", e => {
console.log(e);
});
StmBox.propTypes = {
pageId: PropTypes.string.isRequired,
ctaText: PropTypes.string,
};
StmBox.defaultProps = {
ctaText: "SUBSCRIBE_IN_MESSENGER"
};
export default StmBox;
However I'm getting the error: FB is not defined
@tw0517tw I've created a pull request for this feature. Can you please check it https://github.com/Yoctol/react-messenger-send-to-messenger/pull/6
Is the subscribe event solved?
FB SDK a provides a way to subscribe to the events of STM button (https://developers.facebook.com/docs/messenger-platform/discovery/send-to-messenger-plugin/#event). Is it possible?