Hello, so i tried to attach an attachment in dm but this isnt working. It said invalid attachment type location, from Attaching location | Docs | Twitter Developer Platform the type in json is “location”, if im wrong then what is “location” here? Im using python btw…

data = {
            "event": {
                "type": "message_create",
                "message_create": {
                    "target": {
                        "recipient_id": str(user_id)
                    },
                    "message_data": {
                        
                    },
                },
            }
        }
message_data['attachment'] = {}
                message_data['attachment']['type'] = "location"
                message_data['attachment']["location"] = {}
                message_data['attachment']["location"]["type"] = "shared_place" 
                message_data['attachment']["location"]["shared_place"] = {} 
                message_data['attachment']["location"]["shared_place"]["place"] = {}
                message_data['attachment']["location"]["shared_place"]["place"]["id"] = str(geo.id)

You’re right that this is in the docs, but it should not be there. This feature was removed some time ago. Unfortunately it is no longer possible to add location to a Direct Message via the API.

1 Like

Ahh alright thanks for the insight!

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