1

How do I pass an array of text strings (phone numbers) as a parameter - recipients - to a python function, then translate it into a json payload?

Simplified, the CREATE STATEMENT:

CREATE OR REPLACE FUNCTION skebby_send(user_key text, session_key text, ... recipient text[] ...) 

and have it play nice with this:

payload = """{
    "message_type": "MESSAGE_TYPE", 
    "message": "Hello world!", 
    "recipient": [
        "+393471234567", 
        "+393471234568"
    ], 
    "sender": "MySender", 
    "scheduled_delivery_time": "20161223101010", 
    "order_id": "123456789", 
    "returnCredits": true
}"""

Most reasonably, we would have first done some appropriate query to arrive the list of designated recipients. So, an array, a set, any of the above might be the input to this function, ultimately.

Making a first pass at a Skebby SMS function call here... Skebby API, for those interested, is here: https://developers.skebby.it/?python#send-an-sms-message

DrLou
  • 649
  • 5
  • 21

0 Answers0