Error on creating a direct message with webview button "It should be and only be one url"

direct-messages
urls

#1

Hi

I have a service responding to users dms with information. When I try to send the following URL on a button, I get an error from the API. I googled but couldn’t find any info on the error per se. I’ve sent other URLs before and never had any problems, do I have to URL encode them? didn’t seem to need to on other URLs and the docs don’t mention it. Hope someone can help me with what is wrong with my request.

Request:

POST https://api.twitter.com/1.1/direct_messages/events/new.json PARAMS => Array
(
    [event] => Array
        (
            [type] => message_create
            [message_create] => Array
                (
                    [target] => Array
                        (
                            [recipient_id] => XXXXXXXXX
                        )

                    [message_data] => Array
                        (
                            [text] => Para continuar por favor selecciona la fecha de tu cita
                            [ctas] => Array
                                (
                                    [0] => Array
                                        (
                                            [type] => web_url
                                            [label] => Seleccionar fecha
                                            [url] => https://XXXXX.com/health/schedule.html?botId=66&chatId=66_156723451&e=Cardiología&cm=Clínica Norte
                                        )

                                )

                            [quick_reply] => Array
                                (
                                    [type] => options
                                    [options] => Array
                                        (
                                            [0] => Array
                                                (
                                                    [label] => Ir al principio
                                                    [metadata] => gt@_@12207@_@73@_@principio
                                                )

                                        )

                                )

                        )

                )

        )

)

Response:

{"errors":[{"code":151,"message":"There was an error sending your message: Invalid url field url with value https:\/\/XXXX.com\/health\/schedule.html?botId=66&chatId=66_156723451&e=Cardiolog\u00EDa&cm=Cl\u00EDnica Norte. It should be and only be one url."}]}

Thanks!

EDIT: Just tried URL encoding the URL and it show the same error “It should be and only be one url”. I’m gonna try to see if it doesn’t allow parameters or if it’s the spanish characters of the parameters that are the issue.


#2

@CariAIcom

EDIT: Just tried URL encoding the URL and it show the same error “It should be and only be one url”.

I tried URL-encoded string and it worked, FYI.

https://XXXXX.com/health/schedule.html%3FbotId%3D66%26chatId%3D66_156723451%26e%3DCardiolog%C3%ADa%26cm%3DCl%C3%ADnica%20Norte


closed #3

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.