Last active
August 29, 2015 14:06
-
-
Save hodgestar/1f2f24ac1b68f58ef744 to your computer and use it in GitHub Desktop.
Campaign API design discussion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var api = {}; | |
api.routing = { | |
routing_table: { | |
version: 'fsm-0.1', | |
campaign_id: 'campaign1', | |
components: { | |
'channel1': { | |
type: 'channel', | |
uuid: 'channel1', | |
tag: ['apposit_sms', '*121#'], | |
name: '*121#', | |
description: 'Apposit Sms: *121#', | |
endpoints: [{ | |
type: 'channel_endpoint', | |
uuid: 'endpoint1', | |
name: 'default' | |
}] | |
}, | |
'channel2': { | |
type: 'channel', | |
uuid: 'channel2', | |
tag: ['sigh_sms', '*131#'], | |
name: '*131#', | |
description: 'Sigh Sms: *131#', | |
endpoints: [{ | |
type: 'channel_endpoint', | |
uuid: 'endpoint2', | |
name: 'default' | |
}] | |
}, | |
'channel3': { | |
type: 'channel', | |
uuid: 'channel3', | |
tag: ['larp_sms', '*141#'], | |
name: '*141#', | |
description: 'Larp Sms: *141#', | |
endpoints: [{ | |
type: 'channel_endpoint', | |
uuid: 'endpoint3', | |
name: 'default' | |
}] | |
}, | |
'router1': { | |
type: 'router', | |
router_type: 'keyword', | |
uuid: 'router1', | |
name: 'keyword-router', | |
description: 'Keyword', | |
endpoints: [{ | |
type: 'channel_endpoint', | |
uuid: 'endpoint4', | |
name: 'default' | |
}, | |
{ | |
type: 'conversation_endpoint', | |
uuid: 'endpoint5', | |
name: 'default' | |
}] | |
}, | |
'router2': { | |
type: 'router', | |
router_type: 'keyword', | |
uuid: 'router2', | |
name: 'keyword-router', | |
description: 'Keyword', | |
endpoints: [{ | |
type: 'channel_endpoint', | |
uuid: 'endpoint6', | |
name: 'default' | |
}, | |
{ | |
type: 'conversation_endpoint', | |
uuid: 'endpoint7', | |
name: 'default' | |
}] | |
}, | |
'conversation1': { | |
type: 'conversation', | |
conversation_type: 'bulk-message', | |
uuid: 'conversation1', | |
name: 'bulk-message1', | |
description: 'Some Bulk Message App', | |
endpoints: [{ | |
type: 'conversation_endpoint', | |
uuid: 'endpoint8', | |
name: 'default' | |
}] | |
}, | |
'conversation2': { | |
type: 'conversation', | |
conversation_type: 'bulk-message', | |
uuid: 'conversation2', | |
name: 'bulk-message2', | |
description: 'Some Other Bulk Message App', | |
endpoints: [{ | |
type: 'conversation_endpoint', | |
uuid: 'endpoint9', | |
name: 'default' | |
}] | |
}, | |
'conversation3': { | |
type: 'conversation', | |
conversation_type: 'js-app', | |
uuid: 'conversation3', | |
name: 'js-app1', | |
description: 'Some JS App', | |
endpoints: [{ | |
type: 'conversation_endpoint', | |
uuid: 'endpoint10', | |
name: 'default' | |
}, { | |
type: 'conversation_endpoint', | |
uuid: 'endpoint11', | |
name: 'sms' | |
}] | |
} | |
}, | |
routing: { | |
'endpoint1:endpoint4': { | |
source: 'endpoint1', | |
target: 'endpoint4' | |
}, | |
'endpoint4:endpoint1': { | |
source: 'endpoint4', | |
target: 'endpoint1' | |
} | |
}, | |
}, | |
layout: { | |
version: 'fsm-ui-0.1', | |
components: { | |
'channel1': { | |
// ... | |
}, | |
'conversation1': { | |
x: 5, | |
y: 6, | |
color: 'red' | |
}, | |
'router1': { | |
x: 7, | |
y: 8, | |
color: 'blue' | |
} | |
}, | |
routing: { | |
'endpoint1:endpoint4': 'connection1', | |
'endpoint4:endpoint1': 'connection1' | |
}, | |
connections: { | |
'connection1': { | |
endpoints: { | |
'endpoint1': 'channel1', | |
'endpoint4': 'router1' | |
}, | |
path: [{ | |
x: 6, | |
y: 7 | |
}, { | |
x: 8, | |
y: 9 | |
}], | |
color: 'blue' | |
} | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I added types to endpoints and unified the conversation and channel endpoint lists on routers. Channels may only have
channel_endpoints
(i.e. right-hand endpoints). Conversations may only haveconversation_endpoints
(i.e. left-hand endpoints). Routers may have either.