I was trying to initial and send a proactive message to one Microsoft teams channel with the help of below example: https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/python/16.proactive-messages I added this code to the example in order to initiate a message:
JavaScript
x
11
11
1
connectorClient = await ADAPTER.create_connector_client(service_url=SERVICE_URL)
2
parameters = ConversationParameters(
3
is_group=True,
4
channel_data=CHANNEL_ID,
5
activity=Activity(type=ActivityTypes.message,
6
text='Hello World!'),
7
bot=ChannelAccount(id=BOT_ID),
8
tenant_id=TENANT_ID)
9
response = await connectorClient.conversations.create_conversation(parameters)
10
response.send()
11
But it didn’t work, and I tried many different ways and none of them worked too, always the error is:
JavaScript
1
15
15
1
Traceback (most recent call last):
2
File "/home/farid/works/16.proactive-messages/venv/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
3
resp = await task
4
File "/home/farid/works/16.proactive-messages/venv/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
5
resp = await handler(request)
6
File "/home/farid/works/16.proactive-messages/app.py", line 103, in notify
7
raise exception
8
File "/home/farid/works/16.proactive-messages/app.py", line 100, in notify
9
await _send_proactive_message()
10
File "/home/farid/works/16.proactive-messages/app.py", line 152, in _send_proactive_message
11
response = await connectorClient.conversations.create_conversation(parameters)
12
File "/home/farid/works/16.proactive-messages/venv/lib/python3.7/site-packages/botframework/connector/aio/operations_async/_conversations_operations_async.py", line 176, in create_conversation
13
raise models.ErrorResponseException(self._deserialize, response)
14
botbuilder.schema._models_py3.ErrorResponseException: (BadSyntax) Incorrect conversation creation parameters
15
I don’t know what is my problem here!
Advertisement
Answer
Ok, last night Microsoft added a new python sample which solved this issue: https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/python/58.teams-start-thread-in-channel