Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reply to api initiated conversation not working #142

Closed
Jolg42 opened this issue Feb 14, 2017 · 6 comments
Closed

Reply to api initiated conversation not working #142

Jolg42 opened this issue Feb 14, 2017 · 6 comments

Comments

@Jolg42
Copy link

Jolg42 commented Feb 14, 2017

Version info

  • intercom-node version: 2.8.6
  • Node version: 4.3.1

Expected behavior

After creating and admin or user initiated conversation it would be great to reply to it.

Actual behavior

After creating the admin or user initiated conversation if you try to reply to it providing the conversation id, it's not working.

  • The id of the conversation does not match the id that I can see in the messages inbox... so it looks like the conversation id is not provided...!

Steps to reproduce

  1. Create an admin or user initiated conversation
  2. Reply to it providing the id from last request

Logs

body.errors [{"code":"not_found","message":"Resource Not Found"}]

Workaround

I found that I can pass id: 'last' and it works but it's more an hack...! (Library code enabling that and doc for last reply)

@kant01ne
Copy link
Contributor

kant01ne commented Jun 6, 2017

when creating an admin initiated message from the API like in the example below you are not actually creating a conversation but a message. The id (id: '106118468' in the example below) refers to the message which explains why you are getting a 404 when trying to fetch/reply to a conversation using this message_id.

var message = {
  message_type: "email",
  subject: "Hey",
  body: "Ponies, cute small horses or something more sinister?",
  template: "plain",
  from: {
    type: "admin",
    id: "343616"
  },
  to: {
    type: "user",
    id: "588a21cc7b1ed4f39f0bf2dd"
  }
}

client.messages.create(message, callback);

returns:

body: 
   { type: 'admin_message',
     id: '106118468',
     created_at: 1496756108,
     subject: 'Hey',
     body: 'Ponies, cute small horses or something more sinister?',
     template: 'plain',
     message_type: 'email',
     owner: 
      { type: 'admin',
        id: '343616',
        name: 'Kevin Antoine',
        email: 'kevin.antoine@intercom.io',
        avatar: [Object] } },

The reason why we do not return the conversation_id is that a conversation is not always created when a message is created. This is a limitation of our Engage product that allows sending messages from an admin to X-users. It wouldn't make sense to create a conversation for each outbound messages sent.

A conversation is created only for user-initiated messages. In this case, your workaround using /last/reply is a good workaround/hack. We are going to look into how we can return the conversation_id from the API in this case but I can't give an ETA right now.

@Jolg42
Copy link
Author

Jolg42 commented Jun 6, 2017

Hi @Skaelv
Great! This would be better than the current hack :)

@kant01ne
Copy link
Contributor

kant01ne commented Jun 7, 2017

This is in our backlog for API improvement. I'll close this one as this is related to our API and not specific to intercom-node.
Thanks for reporting this @Jolg42

@kant01ne kant01ne closed this as completed Jun 7, 2017
@davidseek
Copy link

Is there any new development on that? It has been 1yr+ and we're right now in the need of a fix for that.

@davidseek
Copy link

and who should we poke to get this done?

@illyavorobets
Copy link

any updates with it?

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

No branches or pull requests

4 participants