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

Problem with messages.create?

markflorisson opened this issue · comments

Hi -- great lib. But I'm having a problem with intercom.messages.create:

from intercom.client import Client
from intercom.errors import ResourceNotFound

token = '<access token here>'
intercom = Client(personal_access_token=token)

from_user = intercom.users.find(email='<email1>')
to_user = intercom.users.find(email='<email2>')

message_data = {
    'message_type': 'email',
    'subject': 'This Land',
    'body': "Har har har! Mine is an evil laugh!",
    'template': "plain",
    'from': {
        'type': "admin",
        'id': from_user.id,
    },
    'to': {
        'type': "user",
        'id': to_user.id,
    }
}
intercom.messages.create(**message_data)

Which gives me: intercom.errors.ResourceNotFound: Resource Not Found on the intercom.messages.create().

Any ideas?

Never mind, I was using the ID from myself as a user, as opposed to the ID from myself as an admin: https://developers.intercom.com/reference#admins