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

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

Link to this function

optin(context, opts \\ [])

View Source

Contact opts in via a flow

Contact opts out

Link to this function

send_broadcast(context, action, messages)

View Source
@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

Link to this function

send_interactive_message(context, action, messages)

View Source
@spec send_interactive_message(
  Glific.Flows.FlowContext.t(),
  Glific.Flows.Action.t(),
  [
    Glific.Messages.Message.t()
  ]
) :: {:ok, map(), any()}

Send interactive messages

Link to this function

send_message(context, action, messages, cid \\ nil)

View Source
@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