View Source Glific.Flows.ContactAction (Glific v5.1.6)
Since many of the functions, also do a few actions like send a message etc centralizing it here
Link to this section Summary
Functions
Contact opts in via a flow
Contact opts out
This is just a think wrapper for send_message, since its basically the same, but instead of sending the message to the contact, sends it to another contact that is identified in the action. You can send the same notification to multiple contacts
Send interactive messages
If the template is not defined for the message send text messages. Given a shortcode and a context, send the right session template message to the contact.
Link to this section Functions
@spec optin(Glific.Flows.FlowContext.t(), Keyword.t()) :: Glific.Flows.FlowContext.t()
Contact opts in via a flow
@spec optout(Glific.Flows.FlowContext.t()) :: Glific.Flows.FlowContext.t()
Contact opts out
@spec send_broadcast(Glific.Flows.FlowContext.t(), Glific.Flows.Action.t(), [ Glific.Messages.Message.t() ]) :: {:ok, map(), any()}
This is just a think wrapper for send_message, since its basically the same, but instead of sending the message to the contact, sends it to another contact that is identified in the action. You can send the same notification to multiple contacts
@spec send_interactive_message( Glific.Flows.FlowContext.t(), Glific.Flows.Action.t(), [ Glific.Messages.Message.t() ] ) :: {:ok, map(), any()}
Send interactive messages
@spec send_message( Glific.Flows.FlowContext.t(), Glific.Flows.Action.t(), [Glific.Messages.Message.t()], non_neg_integer() | nil ) :: {:ok, map(), any()}
If the template is not defined for the message send text messages. Given a shortcode and a context, send the right session template message to the contact.
We also need to handle translations for template messages, since whatsapp gives them unique uuids