Sending Messages

OutboundHelper(im)

Provides helpers for sending messages.

Arguments:
static delivery_class

The fallback delivery class to use when sending to a Contact().

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 for endpoint in OutboundHelper.endpoints, finally falling back to OutboundHelper.delivery_class. Irrelevant when opts.to is a string. See ContactStore.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.
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.