From 97758002a9fd79b50f3834a5487237f392d52a48 Mon Sep 17 00:00:00 2001 From: Harmon Date: Mon, 11 Jan 2021 10:58:53 -0600 Subject: [PATCH] Allow sending Call-To-Action buttons with Direct Messages In API.send_direct_message Resolves #1311 --- tweepy/api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tweepy/api.py b/tweepy/api.py index 1f5984b..ef87b36 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -441,7 +441,8 @@ class API: ) def send_direct_message(self, recipient_id, text, quick_reply_options=None, - attachment_type=None, attachment_media_id=None): + attachment_type=None, attachment_media_id=None, + ctas=None): """ :reference: https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/new-event :allowed_param: 'recipient_id', 'text', 'quick_reply_type', 'attachment_type', attachment_media_id' @@ -465,6 +466,8 @@ class API: 'type': attachment_type, 'media': {'id': attachment_media_id} } + if ctas is not None: + message_data['ctas'] = ctas return bind_api( api=self, path='/direct_messages/events/new.json', -- 2.25.1