Sending out a chat room invitation with a timeout

I am trying to code a bot which will invite other agents into a multi user chat room. I want to have a time out function that will consider the invitation as rejected after a time is reach and the invitation will be withdrawn. The invitation box on the client end will also close.