taxjar / help_scout-sdk

Ruby Help Scout (aka HelpScout) SDK Using Mailbox API v2.0
MIT License
18 stars 27 forks source link

How to - Create conversation from "user" to a "customer"? #17

Closed ewlarson closed 5 years ago

ewlarson commented 5 years ago

Hi! Thanks for the super helpful gem here.

I feel like I'm missing something obvious... but how do I create a conversation from a HelpScout "user" (myself, our support email address) to be emailed/sent to a "customer" (a client).

Example from the HS Web UI:

Screen Shot 2019-10-31 at 12 21 48 PM

The only way I see to create a conversation in the API is from a customer into our HS mailbox (incoming), not a new conversation with (outgoing) mail to a customer.

What am I missing? Is this possible? Thanks so much in advance for your help!

ewlarson commented 5 years ago

Turns out I was using the wrong thread type.

To create a new conversation FROM a "user" addressed TO a "customer" your thread should use the "reply" type.

data = {
  subject: 'Time for renewal - Invoice #INV-XXXX - Account Name',
  type: 'email',
  mailbox_id: HelpScout.default_mailbox,
  status: 'active',
  customer: { email: 'email@example.com' },
  created_by: 1234,
  threads: [
    {
      type: 'reply',
      customer: { email: 'email@example.com' },
      text: 'A test thread.'
    }
  ]
}

Thanks to Kristi at Help Scout for her super quick answer to my question.