Olark Help Center

Webhooks Integration Tutorial

Last Updated: Mar 05, 2012 02:27PM PST

Using Olark with Webhooks

You're talking with your customers, now build a relationship with them
Anyone with Olark on their site can tell you about all the candid user feedback they get. But you want more than that: maybe you want to follow up on a previous chat, or you want to review past conversations you've had with a visitor before e-mailing them.

  1. Set up your Webhook endpoint. This is what our POSTs will look like (you can populate the "customFields" data using our Javascript Custom Fields API):
    {
      kind: 'conversation',
      id: 'EV695BI2930A6XMO32886MPT899443414',
      items: [
        {kind: 'MessageToVisitor', nickname: "John", timestamp: "1307116657.1", body: "Hi there. Need any help?"},
        {kind: 'MessageToOperator', nickname: "Bob", timestamp: "1307116661.25", body: "Yes, please help me with billing."}
      ],
      visitor: {
        kind: 'Visitor',
        id: '9QRF9YWM5XW3ZSU7P9CGWRU89944341',
        fullName: "John Doe",
        emailAddress: "foo@example.com",
        city: "Palo Alto",
        region: "CA",
        country: "United State",
        countryCode: "US",
        organization: "Widgets Inc.",
        ip: "123.4.56.78",
        browser: "Chrome 12.1",
        operatingSystem: "Windows"
        customFields: {myInternalCustomerId: "12341234", favoriteColor: "blue"}
      }
    }

    Or, if you receive an Offline Message:
    {
      kind: 'Conversation',
      id: 'EV695BI2930A6XMO32886QPT899443414',
      items: [
        {kind: 'OfflineMessage', timestamp: "1307116667.1", body: "Hi there."},
      ],
      visitor: {
        kind: 'Visitor',
        id: '9QRF9YWM5XW3ZSU7P9CGWRU89944341',
        fullName: "John Doe",
        emailAddress: "foo@example.com",
        city: "Palo Alto",
        region: "CA",
        country: "United State",
        countryCode: "US",
        organization: "Widgets Inc.",
        ip: "123.4.56.78",
        browser: "Chrome 12.1",
        operatingSystem: "Windows"
        customFields: {myInternalCustomerId: "12341234", favoriteColor: "blue"}
      }
    }

  2. Enter the address to your Webhook endpoint on our Integration pageAccount Add

  3. Click the "Send Test" button to ensure your endpoint is configured properly.

  4. Now you have the ability to type !lead to post the conversation to your Webhook endpoint. If a conversation continues after you send !lead, we'll do another POST to your endpoint when the conversation finishes. The conversation will have the same ID so you can tell what's what.