0

I'm using a Twilio template that has variables to send a message on WhatsApp, but I want to store the message text in my own tables. However, because it's a template there is no defined "body" variable, so I'm not able to just use message.body to get the text. Below is my code. Is there any way to get the message text in such a scenario?

message = client.messages.create(content_sid='AAAAAAA',
                       from_='BBBBBBB',
                       content_variables=json.dumps(
                         {'1': content_variables['var_a'],
                          '2': content_variables['var_b']
                          '3': content_variables['var_c'],
                          '4': content_variables['vac_d'])),
                          '5': content_variables['vac_e'],
                          '6': content_variables['vac_f']}),
                       to=incoming_data['From'])
  • Can you please describe what you mean by "storing a message text in your own tables"? When using the Content API or Content Editor, you need to create a template with the fixed content ahead of time and then fill in the placeholders when you want to send the message. – IObert Jul 31 '23 at 05:36

0 Answers0