Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Conversational Commerce Infrastructure with Messenger Send API

Conversational Commerce Infrastructure with Messenger Send API

In November 2016, Facebook worked with Sale Stock to hold its first ever Developer Circle in Indonesia. In this meetup, Rizki Romadhoni, Sale Stock Software Engineer, shared his experience in implementing infrastructure for Sale Stock's conversational commerce efforts, alongside its integration with Facebook's Messenger Send API.

Sale Stock Engineering

December 03, 2016
Tweet

More Decks by Sale Stock Engineering

Other Decks in Technology

Transcript

  1. Objective Build a new generation of tools that enable brands

    to communicate with customers in powerful new ways at reduced cost. Experimenting with chatbots, powered by a combination of machine learning, natural language processing, and live operators, to provide customer service, sales support, and other commerce-related functions.
  2. Conversational Commerce Pertains to utilizing chat, messaging, or other natural

    language interfaces (i.e. voice) to interact with people, brands, or services and bots that heretofore have had no real place in the bidirectional, asynchronous messaging context
  3. Clearer Look Conversation Router FB Outbound Inbound Other Outbound FB

    Inbound FB HOOK Messenger Send API HTTP MQ (Kafka) gRPC Autoreplier Internal API
  4. Integration We need to integrate Messenger to have its own

    inbound and outbound on our system. In advance, we can also have a linking account mechanism. • Inbound • Outbound • Auto Replier - Artificial Intelligence • Account Linking • Instant Login
  5. Conversation Router FB Outbound Inbound Other Outbound FB Inbound FB

    HOOK Messenger Send API Autoreplier Inbound Service Internal API
  6. messaging: [ { sender: { id: '10206767926253119' }, recipient: {

    id: '1759085607670907' }, timestamp: 1480056616155, message: { mid: 'mid.1480056616155:f2c5a8c067', seq: 21474, text: 'Bisa bayar di tempat ga sis?' } } ] { senderId: '551e5b22-c1e1-405f-b8aa-bc13fc...', conversationId: '179f8e99-8f85-4beb-a504-...', text: 'Bisa bayar di tempat ga sis?', timestamp: 1480056616155, messageType: 'TEXT', channel: 'FB-MESSAGING', channelKey: '551e5b22-c1e1-405f-b8aa-bc1...', isAgent: false } FB Webhook Gives: Serviam Knows:
  7. Inbound Service - Common Tasks Inbound is the place where

    we translate messenger’s messaging formats to formats that our system understands, there are a lot more things happen here like client-mapping, rule-based replier for transactional conversations, session-management, account linking, etc.
  8. Conversation Router FB Outbound Inbound Other Outbound FB Inbound FB

    HOOK Messenger Send API Autoreplier Replier Service Internal API
  9. Replier Service This is the middleware that processes the messages

    going through our system where bot interacts with customers. On this phase, bot tries to understand the context and figures out what’s the best answer. Bot sends replies it is confident with and leave messages it hesitates with.
  10. Conversation Router FB Outbound Inbound Other Outbound FB Inbound FB

    HOOK Messenger Send API Autoreplier Outbound Service Internal API
  11. Outbound Service This is the place where we translate messages

    back from formats we know to formats that Messenger Send API understands and send these messages to the API. const composeMessagesThenSendToFB = composeP( trackP('8. sendFailedMessagesToInbound'), sendFailedMessagesToInbound, trackP('7. setSentStatusOfMessages'), setSentStatusOfMessages, trackP('6. sendMessagesToFacebook'), sendMessagesToFacebook, trackP('5. getSenderClientIdsOfMessages'), getSenderClientIdsOfMessages, trackP('4. filterSentMessages'), filterSentMessages, trackP('3. getSentStatusesOfMessages'), getSentStatusesOfMessages, trackP('2. getMessages'), getMessages, trackP('1. takeMessages'), takeMessages ); // read: right-to-left
  12. Rule-based Replies Replies are generated by the user’s button-action, let’s

    call it POSTBACK. Each postback has it’s own type and payload. It is where we know the exact reply from. We resolve replies for this message type on Inbound for faster response. buttons: [ { type: 'postback', title: 'Hapus', payload: JSON.stringify({ type: 'DELETE_CART_ITEM', payload: { sku: item.sku, }, }), }, ],
  13. Interaction Spectrum Rule-based AI Customer Service Postback Soraya AI Handle

    natural language conversations known by AI Agents Agents
  14. Artificial Intelligence Replies AI is supposed to answer every incoming

    messages, only if it is confident enough. Otherwise it should be answered by a human.
  15. Yeah we should, these are advantages from an AI existence

    in our system: • Scalability, easy to scale out • Availability, faster response for lots of general questions • Productivity, allow agents to handle unique questions and leave general questions for AI Should we have an AI?
  16. Interaction Spectrum Rule-based AI Customer Service Postback Soraya AI Agents

    Handle conversations that AI is not confident to answer yet Agents Correct AI’s answers
  17. Agent Replies When an incoming message is not a rule-based

    message, or AI can’t handle it, then a human intervention is needed to answer this question, this human could be an agent, customer service, customer support, or any other customer-brand communication role.
  18. Interaction Spectrum Rule-based AI Customer Service Postback Handle transactional conversations:

    buy, add, checkout Soraya AI Handle natural language conversations known by AI Agents Handle conversations that AI is not confident to answer yet Agents Correct AI’s answers
  19. Account Linking We’ve promised sistas to deliver high-quality clothes with

    affordable prices. But we think it’s not enough, we can also deliver it in affordable ways. By linking sistas’ account to their messenger account, they can easily browse products in messenger and whenever a they want it, they can buy it directly on messenger.
  20. Instant Login Login instantly to our web via secured link.

    Deprecated from Serviam because we don’t need this since the release of our in-messenger-checkout. But it is no stranger to this =>
  21. Thank you Facebook For providing us a better way to

    deliver these affordable clothes to all women around the Country :)