Search code examples
pythonbotframeworkchatbot

Problems with the proactive message chatbot


I am building a proactive message using python with the microsoft bot framework. For each user, I use pickle to save the conversation reference property in a file. When I need to send a message to a user, the chatbot loads the conversation reference from the file corresponding to the user and sends the message. The problem I have is that the URL value of the service url is constantly changing: enter image description here

After the url changes, I can no longer use the old conversation reference, how can I send a message to the correct user without asking user interaction to update the conversation reference?


Solution

  • Short answer: don't worry about it

    It sounds like you're already doing things correctly by saving conversation references in order to send proactive messages. The note in your screenshot just means the service URL is not guaranteed to remain the same forever, but the service URL is still effectively stable. There isn't really an operating procedure for what to expect if a service URL changes because it's such a rare event, but I expect the Bot Framework team and the Teams team would make sure to give bot developers plenty of notice.

    To answer your question, if you really want to update your service URL's without making your customers send new messages then you can send a message to your bot yourself and see what the new service URL is and update all your conversation references accordingly. Service URL's are root paths used for various API calls so they are not scoped to specific users or specific conversations. You can expect the service URL to be the same for you and your customers. Teams is a bit of an exception because the channel has multiple service URL's to account for different regions, so you may need to use some kind of proxy to simulate users in other regions.