Olen/Spond

usage of send_message()

Closed this issue · 7 comments

Hey,

What should I use as parameter for recipient, when I call get_message?
I've already used the member id and what appears to be a chat id, but in both cases it doesn't work and I get this in response.

<ClientResponse(https://chat.spond.com/messages) [400 Bad Request]>

Thanks

Amaury

Hi, I found the error. You must use chatId and not recipient in the payload of the http request.

I've not used this yet l, but am interested.

How do I determine what chatID value to use?

I found it in the response of the method get_messages()

But before you've to change the method send_message() in the spond.py file with

    async def send_message(self, chatId, text):
        if not self.cookie:
            await self.login()
        url = self.chaturl + "/messages"
        data = { 'chatId': chatId, 'text': text, 'type': "TEXT" }
        headers = { 'auth': self.auth }
        r = await self.clientsession.post(url, json=data, headers=headers)
        print(r)
        return await r.json()

Would you like to submit a pull request to fix get_messages() and send_message()?
It would be good to include docstrings and README update.
If not, I should be able to do it in the next few days.

Re:

found it in the response of the method get_messages()"

I guess this means it's currently possible only to send messages to an existing chat conversation, not to instigate a new one?

I will do a PR :)

PR merged