ker0x/messenger

Allow sending messages with `user_ref` recipient

matusmarcin opened this issue · 3 comments

Description
I am trying to send a message with a user_ref string (received from Messenger Checkbox), this is not possible though, because the constructed message has pretty much hardcoded recipient with id key.

Example

It could be perhaps done just by removing type string for $recipient from message on Send and ?string type in the constructor of SendRequest.

Then the following should work:

$messenger->send()->message(['user_ref' => $recipient], $message);

And the constructed message would comply with the format specified here.

{
  "recipient": {
    "user_ref":"<UNIQUE_REF_PARAM>"
  }, 
  "message": {
    "text":"hello, world!"
  }
ker0x commented

Hello @matusmarcin, thank you for reporting this issue. I just release a patch to fix it. You can now pass a string or an array as recipient.

Wow, @ker0x, that's amazing. Thanks a lot!

I am going to try it out.

@ker0x Confirming that it works for me. Thank you for a quick fix.