Skip to content

Instantly share code, notes, and snippets.

@klapperkopp
Last active September 14, 2022 11:50
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 klapperkopp/499c0dc924d3eb70fbfb87d545dfc024 to your computer and use it in GitHub Desktop.
Save klapperkopp/499c0dc924d3eb70fbfb87d545dfc024 to your computer and use it in GitHub Desktop.
{
"name": "Whatsapp News Send",
"tags": [
"news",
"de",
"2022-10-01"
],
"definition": {
"type": "segmentation-job",
"recipients": {
"include": [
{
"id": "[LIST-ID]",
"type": "list"
}
]
},
"segmentations": [
{
"recipient": {
"correlation_id": "{{item.phoneNumber}}"
},
"condition": {
"expression": "item.subscribed == true && item.interests.includes('politics')"
},
"action_call": {
"action_ref": {
"type": "action",
"id": "{{segmentSportsSendWhatsappActionId}}"
},
"parameters": [
{
"name": "message",
"value": "{{ template.custom }}"
},
{
"name": "message_type",
"value": "{{ template.message_type }}"
},
{
"name": "toNumber",
"value": "{{ item.phoneNumber }}"
}
]
},
"name": "Daily Deals Test 1",
"description": "This is a test #1",
"template": {
"message_type": "custom",
"custom": {
"type": "template",
"template": {
"namespace": "whatsapp_namespace_id",
"name": "whatsapp_news_template_name",
"language": {
"policy": "deterministic",
"code": "de"
},
"components": [
{
"type": "header",
"parameters": [
{
"type": "image",
"image": {
"link": "https://media1.faz.net/ppmedia/aktuell/1039690016/1.7599119/default-retina/kanzlerin-angela-merkel.jpg"
}
}
]
},
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "Breaking: *Ex Chancellor chillign hard*"
},
{
"type": "text",
"text": "We all knew Angie likes to keep things secret, but this is crazy. Click the link to find out more..."
}
]
},
{
"type": "button",
"sub_type": "url",
"index": 0,
"parameters": [
{
"type": "text",
"text": "/2022/10/01/headlines/angie-merkel-parties-hard"
}
]
}
],
}
}
}
}
],
"events_handler": {
"matching_strategy": "match-first",
"matchers": [
{
"condition": {
"expression": "event.text?.toLowerCase().includes('stop')"
},
"recipient": {
"correlation_id": "{{event.from}}"
},
"name": "opt-out",
"description": "unsubscribe",
"action_call": {
"action_ref": {
"type": "action",
"id": "{{unsubscribeActionID}}"
},
"parameters": [
{
"name": "action",
"value": "unsubscribe"
},
{
"name": "to",
"value": "{{event.to}}"
},
{
"name": "from",
"value": "{{event.from}}"
},
{
"name": "message_uuid",
"value": "{{event.message_uuid}}"
},
{
"name": "message",
"value": "message is in the 'action'"
}
]
}
},
{
"condition": {
"expression": "event_type==='recipient-response'"
},
"recipient": {
"correlation_id": "{{event.from}}"
},
"name": "ready to engage",
"description": "start interaction",
"action_call": {
"action_ref": {
"type": "action",
"id": "{{responseProcessingActionId}}"
},
"parameters": [
{
"name": "action",
"value": "{{event.text}}"
},
{
"name": "to",
"value": "{{event.to}}"
},
{
"name": "from",
"value": "{{event.from}}"
},
{
"name": "message_uuid",
"value": "{{event.message_uuid}}"
},
{
"name": "message",
"value": "message is in the 'action'"
}
]
}
}
]
}
}
}
{
"name": "News Subscribers",
"labels": [
{
"name": "phoneNumber"
},
{
"name": "interests"
},
{
"name": "subscribed",
"required": true
}
],
"tags": [
"news",
"de",
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment