Sending Messages¶
-
OutboundHelper
(im)¶ Provides helpers for sending messages.
Arguments: - im (InteractionMachine) – the interaction machine associated to the helper.
-
static
send
(opts)¶ Sends a message to an address or contact.
Arguments: - opts.to (string or
Contact()
.) – The address or contact to send to. - opts.endpoint (string) – The endpoint to send to over (for e.g.
'sms'
). Needs to be one of the endpoints configured in the app’s config. - opts.content (string or
LazyText()
) – The content to be sent. - opts.delivery_class (string) – The delivery class to send over for the contact (for e.g. if
'ussd'
is given, the helper will send to the contact’s the contact’s'msisdn'
address). If not given, uses the delivery class configured forendpoint
inOutboundHelper.endpoints
, finally falling back toOutboundHelper.delivery_class
. Irrelevant whenopts.to
is a string. SeeContactStore.get()
for a list of the supported delivery classes. - opts.lang (string) – a letter language code (e.g.
sw
,en
) to translate the content. If not given, the content will be translated to the user’s current language.
- opts.to (string or
-
static
send_to_user
(endpoint)¶ Sends a message to the current user.
Arguments: - opts.endpoint (string) – The endpoint to send to over (for e.g.
'sms'
). Needs to be one of the endpoints configured in the app’s config. - opts.content (string) – The content to be sent.
- opts.lang (string) – a letter language code (e.g.
sw
,en
) to translate the content. If not given, the content will be translated to the user’s current language.
- opts.endpoint (string) – The endpoint to send to over (for e.g.