sferik / twitter-ruby

A Ruby interface to the Twitter API.
http://www.rubydoc.info/gems/twitter
MIT License
4.58k stars 1.3k forks source link

Cannot add Quick Replies to welcome message #1011

Closed erik-prog-eng closed 1 year ago

erik-prog-eng commented 2 years ago

When trying to add quick replies to welcome message with create_welcome_message, it will not add them. Reason is, that when you add quick replies, it will add the options to the json_options object, when in actuality, it needs to attached into the message_data object.

https://github.com/sferik/twitter/blob/master/lib/twitter/rest/direct_messages/welcome_messages.rb

json_options = {
  welcome_message: {
    message_data: {
      text: text,
    },
  },
}

# Wrong
json_options.merge!(options)
# Will work
json_options[:welcome_message][:message_data].merge!(options)

As project is unmaintained, current option is to monkey patch it.