Just to try to give you an idea of what we are trying to do: we have a Python system that works like a chatbot, answering some questions automatically, but there comes a time when we need to send the contact to the service one by one, and we need to use Python to open the conversation in Flex
I tried many ways to send messages to a chat on Flex, but as I said previously we just able to create a chat no send messages into it, better saying, we’re able to send the messages but they don’t appear on Flex’s chat interface (that’s weird). I tried 1) using the normal way via API, 2) creating a Runtime function (the same result than via API, just creating a chat but no messages appearing), 3) I tried applying Twilio Sync, and also 4) I tried using Twilio Proxy directly.
I can get the sid
for all objects created and see the chat created on Flex interface, but I can't see the messages sent to this chat on Flex's UI.
event = {
'from': 'phone_number_from',
'to': 'flex_phone_number',
'body': 'Testing'
}
attrs = get_channel_attrs(event.get('from'))
channel = get_or_create_chat_channel(event.get('from'), event.get('to'), attrs)
print('Channel created: %s' % channel.sid)
task = get_or_create_ongoing_tasks(event.get('from'), channel.sid)
print('Task created: %s' % task.sid)
message = send_message(channel=channel, from_=event.get('from'), body=event.get('body'))
print('Message created: %s' % message.sid)
-----------------------
Channel created: CH99b4831f********************
Task created: WTe8eee516********************
Message created: IM08884be42********************