Delete Welcome Message through the API

restapi
directmessages
php
welcomemessage

#1

Hi everybody,

i use the library TwitterAPIExchange to interact with the api.

I haven’t any problem to create welcome messages but i can’t delete it…

Here is my code :

$url = "https://api.twitter.com/1.1/direct_messages/welcome_messages/destroy.json?id=" . $message_id;
        
        $result = $this->twitter->buildOauth($url, "DELETE")->performRequest(true, [
            CURLOPT_HTTPHEADER => array('Content-Type:application/json'),
            CURLOPT_POSTFIELDS => json_encode(['id' => $message_id])
        ]);
        
        debug("DELETE WM");

Thanks for you help.