Skip to content

Instantly share code, notes, and snippets.

@Shugabuga
Created December 27, 2018 17:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shugabuga/d01fd2c18b2d97692d13174617ac5010 to your computer and use it in GitHub Desktop.
Save Shugabuga/d01fd2c18b2d97692d13174617ac5010 to your computer and use it in GitHub Desktop.
NOTE: All requests must have a proper oAuth authorization header.
List all current welcome messages:
GET https://api.twitter.com/1.1/direct_messages/welcome_messages/rules/list.json
Create new template:
POST https://api.twitter.com/1.1/direct_messages/welcome_messages/new.json
Data: {
"welcome_message": {
"name": "init_welcome",
"message_data": {
"text": "Hi, I'm Shuga! What's up?",
"quick_reply": {
"type": "options",
"options": [
{
"label": "Let's chat.",
"description": "Talk to me for no particular reason.",
"metadata": "init_talk"
},
{
"label": "I need help!",
"description": "Request support for a Shuga Holdings-owned project.",
"metadata": "init_support"
},
{
"label": "I'm interested in commissions.",
"description": "Order custom banners, icons, and more.",
"metadata": "init_order"
},
{
"label": "Let's talk about
@SmashAdditions
.",
"description": "Submit manual request or ask some questions.",
"metadata": "init_smash"
}
]
}
}
}
}
Set template as welcome message:
POST https://api.twitter.com/1.1/direct_messages/welcome_messages/rules/new.json
Data: {
"welcome_message_rule": {
"welcome_message_id": "MESSAGE_ID_FROM_TEMPLATE_CREATION"
}
}
Delete welcome message rule:
DELETE https://api.twitter.com/1.1/direct_messages/welcome_messages/rules/destroy.json?id=MESSAGE_ID_FROM_TEMPLATE_CREATION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment