Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with send_conversation_message #83

Open
emorissettegregoire opened this issue Nov 1, 2022 · 2 comments
Open

Issue with send_conversation_message #83

emorissettegregoire opened this issue Nov 1, 2022 · 2 comments

Comments

@emorissettegregoire
Copy link

emorissettegregoire commented Nov 1, 2022

Hi folks,
For versions > 1.4.2 when calling the send_conversation_message method

channel_id = "my_channel_id"
to = "my_whatsapp_number"
client = MessageBird::Client.new('MY_ACCESS_KEY')
message = client.send_conversation_message(channel_id, to, type: 'text', content: { text: 'Hello!' })

I receive the following error:

MessageBird::ErrorException: MessageBird::ErrorException
.../gems/ruby-2.7.4/gems/messagebird-rest-3.1.1/lib/messagebird/client.rb:91:in `parse_body' when calling this method.

It is working properly for version <= 1.4.2

Thank you for helping.

@qvrb
Copy link

qvrb commented Mar 7, 2023

that error is fixed in 4.0.0 but there's an issue in 4.0.0 with respect to channel_id being passed instead of ChannelId

@qvrb
Copy link

qvrb commented Mar 8, 2023

if you're stuck on 3.0.0 the issue is that the call expects a hash params.merge but then it calls JSON.parse in the parse_body method which expects a string. So the answer is to override the parse_body

    def parse_body(body)
      json = body.class == String ? body : body.to_json
      super(json)
    end


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants