intercom / python-intercom

Python wrapper for the Intercom API.

Home Page:https://keyes.ie/things/python-intercom/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to reply to user's last conversation?

justinjdickow opened this issue · comments

What's the proper way to reply to a user's last conversation?

I'm trying

conversations = intercom_client.conversations.find(email=user.email)
    last_convo_id = conversations.conversations[0]['id']

    intercom_client.conversations.reply(
        id=last_convo_id,
        type='user',
        email=user.email,
        body=body,
        message_type='message'
    )

But receiving the following error
intercom.errors.ResourceNotFound: User Not Found

I've also tried

 intercom_client.conversations.reply(
        id='last',
        type='user',
        email=user.email,
        body=body,
        message_type='message'
    )

Based on a few other issues but get the same error. I have confirmed that I have conversations started with this user, and can create new ones using

intercom_client.messages.create(**{
        'from': {
            'type': 'user',
            'id': user.id
        },
        'body': body
    })

But seem unable to reply to any of them

My issue was to use intercom_user_id=user.id and message_type='comment'