Messaging

dojah.messaging.register_sender_id(sender_id):

This method can be used to register sender Id

Usage

from dojahcore.dojah import Dojah

api = Dojah()
try:
    sender_id  = api.messaging.register_sender_id('Test')
    print(sender_id)
except Exception as e:
    print(str(e))

Arguments

Arguments Type Description
sender_id * string The sender id to register required
first_name * string The first_name to validate against the bvn required
last_name * string The last_name to validate against the bvn required
dob * string The date of birth to validate against the bvn yyyy-mm-dd required

Returns

{
   "message":""
}

dojah.messaging.fetch_sender_ids()

This method can be used to fetch sender Id

Usage

from dojahcore.dojah import Dojah

api = Dojah()
try:
    sender_ids  = api.messaging.fetch_sender_ids()
    print(sender_ids)
except Exception as e:
    print(str(e))

Returns

[
    {
        "sender_id":"",
        "activated": True,
        "createdAt": ""
    
    }
]

dojah.messaging.send_message(sender_id, channel, destination,message, priority=False)

Deliver Transaction message to customer

Usage

from dojahcore.dojah import Dojah

api = Dojah()
try:
    msg  = api.messaging.send_message("Test", "sms", "09099909878","message",True)
    print(msg)
except Exception as e:
    print(str(e))
Arguments Type Description
bvn * string The bank verification number to validate required
first_name * string The first_name to validate against the bvn required
last_name * string The last_name to validate against the bvn required
dob * string The date of birth to validate against the bvn yyyy-mm-dd required

Arguments

sender_id: Registered sender Id
channel: sms or whatsapp
destination: Phone number of recipient
message: Body of message
priority:(optional) Indicates if you want to send in priority mode

Returns

{
   "status":"Sent",
   "mobile":"2349099909878",
   "message_id":"dj_e59ceeb2-a880-4f14-8385-c4275a08b552",
   "reference_id":"5490f226-0bf6-4e4c-892a-b06c4d77b6a1"
}

dojah.messaging.get_status(message_id)

Get status of the message

Usage

from dojahcore.dojah import Dojah

api = Dojah()
try:
    msg  = api.messaging.get_status("dj_e59ceeb2-a880-4f14-8385-c4275a08b552")
    print(msg)
except Exception as e:
    print(str(e))

Arguments

Arguments Type Description
message_id * string Message Id required

Returns

{
   "status":"Sent"
}

dojah.messaging.send_otp(sender_id,destination,channel,expiry=10,length=6, priority=False, otp=None)

This Method send_otp() Deliver OTPs to your users.

Usage

from dojahcore.dojah import Dojah

api = Dojah()
try:
    otp  = api.messaging.send_otp("sender_id","destination","whatsapp",expiry=10,length=6, priority=False, otp=None)
    print(otp)
except Exception as e:
    print(str(e))

Arguments

Arguments Type Description
sender_id * string The sender Id to associate the message with required
destination * string The receiver's phone number required
channel * string whatsapp, voice or sms required
expiry string Number of minutes before token expires optional
length string length of token, 4-6 characters, default is 6 optional
priority string Indicate whether to send in priority mode optional
otp string The Otp optional

Returns

[
   {
      "reference_id":"40a31bb4-20e8-45ad-b645-294b11dde250",
      "destination":"09069983293",
      "status_id":"dj_88cdabb2-98b8-4f6b-b3bf-2c9f84a0d7c6",
      "status":"voice OTP sent successfully "
   }
]

dojah.messaging.validate_otp(code, reference_id)

Validaes the token received by the user

Usage

from dojahcore.dojah import Dojah

api = Dojah()
try:
    otp  = api.messaging.validate_otp('2345','40a31bb4-20e8-45ad-b645-294b11dde250')
    print(otp)
except Exception as e:
    print(str(e))

Arguments

Arguments Type Description
code * string The Otp code from the user required
reference_id * string Refrerence Id Returns required

Returns

{
   "valid":"True"
}

Did this page help you?